Permalink
Browse files

document id prefixed String usage of `.find`. refs #12891 [ci skip]

  • Loading branch information...
1 parent aae99c9 commit 514c4d7b2e7f3de72de6564a286c3aba8bf88599 @senny senny committed Nov 15, 2013
Showing with 6 additions and 5 deletions.
  1. +6 −5 activerecord/lib/active_record/relation/finder_methods.rb
@@ -4,11 +4,12 @@ module FinderMethods
# 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)
#
# Note that returned records may not be in the same order as the ids you

0 comments on commit 514c4d7

Please sign in to comment.