Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove order_values argument now that default_scope is simplified

In 94924dc 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.
  • Loading branch information...
commit 5e6de3942ffbc667d1f43860a0c80dd8031a0c60 1 parent 94924dc
Carlos Antonio da Silva carlosantoniodasilva authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 activerecord/lib/active_record/relation/finder_methods.rb
10 activerecord/lib/active_record/relation/finder_methods.rb
View
@@ -32,7 +32,7 @@ module FinderMethods
# end
#
# ==== Variations of +find+
- #
+ #
# Person.where(name: 'Spartacus', rating: 4)
# # returns a chainable list (which can be empty).
#
@@ -49,7 +49,7 @@ module FinderMethods
#
# 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 @@ def take!
#
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 @@ def find_first
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
Please sign in to comment.
Something went wrong with that request. Please try again.