Skip to content
Browse files

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

  • Loading branch information...
1 parent aa7fdfb commit 77ed4d98a7147fcfa1c340385f767a0010abe82a @senny senny committed
Showing with 6 additions and 5 deletions.
  1. +6 −5 activerecord/lib/active_record/relation/finder_methods.rb
View
11 activerecord/lib/active_record/relation/finder_methods.rb
@@ -6,11 +6,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)
#
# <tt>ActiveRecord::RecordNotFound</tt> will be raised if one or more ids are not found.

2 comments on commit 77ed4d9

@mbhnyc

wow, no idea that worked. v cool.

Please sign in to comment.
Something went wrong with that request. Please try again.