From 011863673a353c334ddb2c93227dceadc5d7c3b6 Mon Sep 17 00:00:00 2001 From: Alvaro Pereyra Date: Mon, 28 May 2012 02:28:35 -0500 Subject: Adds examples to FinderMethods#first [ci skip] --- activerecord/lib/active_record/relation/finder_methods.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 9d62e726d4..c1783dba72 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -87,6 +87,7 @@ module ActiveRecord # Person.where(["user_name = ?", user_name]).first # Person.where(["user_name = :u", { :u => user_name }]).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) if limit if order_values.empty? && primary_key -- cgit v1.2.3