Skip to content

Commit

Permalink
Adds examples to FinderMethods#first [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
alessapereyra committed May 28, 2012
1 parent 422d3a4 commit 0118636
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions activerecord/lib/active_record/relation/finder_methods.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def take!
# Person.where(["user_name = ?", user_name]).first # Person.where(["user_name = ?", user_name]).first
# Person.where(["user_name = :u", { :u => user_name }]).first # Person.where(["user_name = :u", { :u => user_name }]).first
# Person.order("created_on DESC").offset(5).first # Person.order("created_on DESC").offset(5).first
# Person.first(3) # returns the first objects fetched by SELECT * FROM people LIMIT 3
def first(limit = nil) def first(limit = nil)
if limit if limit
if order_values.empty? && primary_key if order_values.empty? && primary_key
Expand Down

0 comments on commit 0118636

Please sign in to comment.