diff options
author | Dmitry Polushkin <dmitry.polushkin@gmail.com> | 2013-06-10 14:38:32 +0200 |
---|---|---|
committer | Dmitry Polushkin <dmitry.polushkin@gmail.com> | 2013-06-10 14:38:32 +0200 |
commit | e720b50fb1ff841970b2f1198996144c35b48461 (patch) | |
tree | 348b9b0bde8ee29bcba12e09fe6df760b0c9e670 /activerecord/lib/active_record/relation | |
parent | d5450a6659a33ef08a170afcaae084023bcd275b (diff) | |
download | rails-e720b50fb1ff841970b2f1198996144c35b48461.tar.gz rails-e720b50fb1ff841970b2f1198996144c35b48461.tar.bz2 rails-e720b50fb1ff841970b2f1198996144c35b48461.zip |
rename method `find_first_records` to `find_first_with_limit`
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index cf71df8fba..f240d0aaa9 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -81,7 +81,7 @@ module ActiveRecord # Person.first(3) # returns the first three objects fetched by SELECT * FROM people LIMIT 3 def first(limit = nil) if limit - find_first_records(order_values, limit) + find_first_with_limit(order_values, limit) else find_first end @@ -303,11 +303,11 @@ module ActiveRecord if loaded? @records.first else - @first ||= find_first_records(with_default_scope.order_values, 1).first + @first ||= find_first_with_limit(with_default_scope.order_values, 1).first end end - def find_first_records(order_values, limit) + def find_first_with_limit(order_values, limit) if order_values.empty? && primary_key order(arel_table[primary_key].asc).limit(limit).to_a else |