diff options
-rw-r--r-- | railties/guides/source/active_record_querying.textile | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/railties/guides/source/active_record_querying.textile b/railties/guides/source/active_record_querying.textile index 9ab8266d2e..a28af04301 100644 --- a/railties/guides/source/active_record_querying.textile +++ b/railties/guides/source/active_record_querying.textile @@ -71,7 +71,7 @@ Active Record lets you retrieve a single object using three different ways. h5. Using a primary key -Using <tt>Model.find(primary_key)</tt>, you can retrieve the object corresponding to the supplied _primary key_. For example: +Using <tt>Model.find(primary_key, options = nil)</tt>, you can retrieve the object corresponding to the supplied _primary key_ and matching the supplied options (if any). For example: <ruby> # Find the client with primary key (id) 10. @@ -131,7 +131,7 @@ h4. Retrieving Multiple Objects h5. Using multiple primary keys -<tt>Model.find(array_of_primary_key)</tt> also accepts an array of _primary keys_. An array of all the matching records for the supplied _primary keys_ is returned. For example: +<tt>Model.find(array_of_primary_key, options = nil)</tt> also accepts an array of _primary keys_. An array of all the matching records for the supplied _primary keys_ is returned. For example: <ruby> # Find the clients with primary keys 1 and 10. @@ -165,6 +165,8 @@ SELECT * FROM clients <tt>Model.all</tt> returns an empty array +[]+ if no matching record is found. No exception will be raised. +NOTE: +Model.find(:all, options)+ is equivalent to +Model.all(options)+ + h3. Conditions The +find+ method allows you to specify conditions to limit the records returned. You can specify conditions as a string, array, or hash. |