diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-06-28 09:51:13 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-06-28 09:51:14 -0300 |
commit | 5e6de3942ffbc667d1f43860a0c80dd8031a0c60 (patch) | |
tree | 024a429f9e8e4d67520d471867d24c58dc4dfa00 /activerecord/lib | |
parent | 94924dc32baf78f13e289172534c2e71c9c8cade (diff) | |
download | rails-5e6de3942ffbc667d1f43860a0c80dd8031a0c60.tar.gz rails-5e6de3942ffbc667d1f43860a0c80dd8031a0c60.tar.bz2 rails-5e6de3942ffbc667d1f43860a0c80dd8031a0c60.zip |
Remove order_values argument now that default_scope is simplified
In 94924dc32baf78f13e289172534c2e71c9c8cade the internal default_scope
implementation has changed making it simpler to follow, meaning that the
old usage of with_default_scope has been removed.
With that, order_values was the same argument for both calls to
find_first_with_limit, so remove it and use the existent attribute
for the sake of clarity/simplification.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 4ea13e2585..bad5886cde 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -32,7 +32,7 @@ module ActiveRecord # end # # ==== Variations of +find+ - # + # # Person.where(name: 'Spartacus', rating: 4) # # returns a chainable list (which can be empty). # @@ -49,7 +49,7 @@ module ActiveRecord # # Person.where(name: 'Spartacus', rating: 4).exists?(conditions = :none) # # returns a boolean indicating if any record with the given conditions exist. - # + # # Person.where(name: 'Spartacus', rating: 4).select("field1, field2, field3") # # returns a chainable list of instances with only the mentioned fields. # @@ -124,7 +124,7 @@ module ActiveRecord # def first(limit = nil) if limit - find_first_with_limit(order_values, limit) + find_first_with_limit(limit) else find_first end @@ -353,11 +353,11 @@ module ActiveRecord if loaded? @records.first else - @first ||= find_first_with_limit(order_values, 1).first + @first ||= find_first_with_limit(1).first end end - def find_first_with_limit(order_values, limit) + def find_first_with_limit(limit) if order_values.empty? && primary_key order(arel_table[primary_key].asc).limit(limit).to_a else |