diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-11-15 10:10:09 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-11-15 10:13:42 +0100 |
commit | 77ed4d98a7147fcfa1c340385f767a0010abe82a (patch) | |
tree | de4996348eb11c62490948cd48d44100812b0b00 /activerecord/lib/active_record/relation | |
parent | aa7fdfb859d8a73f58460a7aba7174a47b5101d5 (diff) | |
download | rails-77ed4d98a7147fcfa1c340385f767a0010abe82a.tar.gz rails-77ed4d98a7147fcfa1c340385f767a0010abe82a.tar.bz2 rails-77ed4d98a7147fcfa1c340385f767a0010abe82a.zip |
document id prefixed String usage of `.find`. refs #12891 [ci skip]
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 3a02bf90e9..d91d6367a3 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -6,11 +6,12 @@ module ActiveRecord # 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+. # - # Person.find(1) # returns the object for ID = 1 - # Person.find("1") # returns the object for ID = 1 - # Person.find(1, 2, 6) # returns an array for objects with IDs in (1, 2, 6) - # Person.find([7, 17]) # returns an array for objects with IDs in (7, 17) - # Person.find([1]) # returns an array for the object with ID = 1 + # Person.find(1) # returns the object for ID = 1 + # Person.find("1") # returns the object for ID = 1 + # Person.find("31-sarah") # returns the object for ID = 31 + # Person.find(1, 2, 6) # returns an array for objects with IDs in (1, 2, 6) + # Person.find([7, 17]) # returns an array for objects with IDs in (7, 17) + # Person.find([1]) # returns an array for the object with ID = 1 # Person.where("administrator = 1").order("created_on DESC").find(1) # # <tt>ActiveRecord::RecordNotFound</tt> will be raised if one or more ids are not found. |