diff options
author | Reg Braithwaite <reg@braythwayt.com> | 2012-04-12 22:55:11 -0400 |
---|---|---|
committer | Reg Braithwaite <reg@braythwayt.com> | 2012-04-12 22:55:11 -0400 |
commit | dcb2279674fef7358c894445c9cd7c4827b90b10 (patch) | |
tree | 9c4d0291390a12202d22c772e243326f100cb9eb | |
parent | 859a91b59a7b58198e5fdb382fb6e610b2738034 (diff) | |
download | rails-dcb2279674fef7358c894445c9cd7c4827b90b10.tar.gz rails-dcb2279674fef7358c894445c9cd7c4827b90b10.tar.bz2 rails-dcb2279674fef7358c894445c9cd7c4827b90b10.zip |
mention that coercion only happens when the primary key is an integer and use +to_i+ formatting
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index af89493d9d..52061a2286 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -6,8 +6,8 @@ module ActiveRecord # Find operates with four different retrieval approaches: # # * Find by id - This can either be a specific id (1), a list of ids (1, 5, 6), or an array of ids ([5, 6, 10]). - # If no record can be found for all of the listed ids, then RecordNotFound will be raised. Find by id coerces - # its arguments to integers using #to_i. + # If no record can be found for all of the listed ids, then RecordNotFound will be raised. If the primary key + # is an integer, find by id coerces its arguments using +to_i+. # * Find first - This will return the first record matched by the options used. These options can either be specific # conditions or merely an order. If no record can be matched, +nil+ is returned. Use # <tt>Model.find(:first, *args)</tt> or its shortcut <tt>Model.first(*args)</tt>. |