From 5e6de3942ffbc667d1f43860a0c80dd8031a0c60 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Fri, 28 Jun 2013 09:51:13 -0300 Subject: 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. --- activerecord/lib/active_record/relation/finder_methods.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activerecord') 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 -- cgit v1.2.3