aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorDamien Mathieu <42@dmathieu.com>2011-09-01 11:24:19 +0200
committerDamien Mathieu <42@dmathieu.com>2011-09-05 13:09:52 +0200
commit451cdd62ce54080d0a4944551fbc3f10cc34a42d (patch)
treefd5c5b14c76a5aab88ee7081bcb363134b9e9cd4 /activerecord/lib/active_record
parent24ee573d6ce8bb11f7eb62224feca5a87fdd2a69 (diff)
downloadrails-451cdd62ce54080d0a4944551fbc3f10cc34a42d.tar.gz
rails-451cdd62ce54080d0a4944551fbc3f10cc34a42d.tar.bz2
rails-451cdd62ce54080d0a4944551fbc3f10cc34a42d.zip
use LIMIT SQL word in first - Closes #2783
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb
index 73368aed18..2639c46709 100644
--- a/activerecord/lib/active_record/relation/finder_methods.rb
+++ b/activerecord/lib/active_record/relation/finder_methods.rb
@@ -114,7 +114,7 @@ module ActiveRecord
def first(*args)
if args.any?
if args.first.kind_of?(Integer) || (loaded? && !args.first.kind_of?(Hash))
- to_a.first(*args)
+ limit(*args).to_a
else
apply_finder_options(args.first).first
end