Skip to content

Commit db0e649

Browse files
committed
Merge pull request rails#20106 from claudiob/finder-rails3
[ci skip] Stop explaining finders for Rails 3
2 parents 6285fc1 + fe41c01 commit db0e649

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

activerecord/lib/active_record/relation/finder_methods.rb

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,11 @@ def take!
111111
# Find the first record (or first N records if a parameter is supplied).
112112
# If no order is defined it will order by primary key.
113113
#
114-
# Person.first # returns the first object fetched by SELECT * FROM people
114+
# Person.first # returns the first object fetched by SELECT * FROM people ORDER BY people.id LIMIT 1
115115
# Person.where(["user_name = ?", user_name]).first
116116
# Person.where(["user_name = :u", { u: user_name }]).first
117117
# Person.order("created_on DESC").offset(5).first
118-
# Person.first(3) # returns the first three objects fetched by SELECT * FROM people LIMIT 3
119-
#
120-
# ==== Rails 3
121-
#
122-
# Person.first # SELECT "people".* FROM "people" LIMIT 1
123-
#
124-
# NOTE: Rails 3 may not order this query by the primary key and the order
125-
# will depend on the database implementation. In order to ensure that behavior,
126-
# use <tt>User.order(:id).first</tt> instead.
127-
#
128-
# ==== Rails 4
129-
#
130-
# Person.first # SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
118+
# Person.first(3) # returns the first three objects fetched by SELECT * FROM people ORDER BY people.id LIMIT 3
131119
#
132120
def first(limit = nil)
133121
if limit

0 commit comments

Comments
 (0)