Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move the except(:select) inside the construct_limited_ids_condition m…

…ethod to pair it closely with its motivation.
  • Loading branch information...
commit cd04a99ba4b5227fb103b6d4e7504c770833e612 1 parent ec75ff3
Ben Woosley Empact authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/relation/finder_methods.rb
4 activerecord/lib/active_record/relation/finder_methods.rb
View
@@ -234,7 +234,7 @@ def apply_join_dependency(relation, join_dependency)
limitable_reflections = using_limitable_reflections?(join_dependency.reflections)
if !limitable_reflections && relation.limit_value
- limited_id_condition = construct_limited_ids_condition(relation.except(:select))
+ limited_id_condition = construct_limited_ids_condition(relation)
relation = relation.where(limited_id_condition)
end
@@ -247,7 +247,7 @@ def construct_limited_ids_condition(relation)
values = @klass.connection.columns_for_distinct(
"#{quoted_table_name}.#{quoted_primary_key}", relation.order_values)
- relation = relation.dup.select(values).distinct!
+ relation = relation.except(:select).select(values).distinct!
id_rows = @klass.connection.select_all(relation.arel, 'SQL', relation.bind_values)
ids_array = id_rows.map {|row| row[primary_key]}
Please sign in to comment.
Something went wrong with that request. Please try again.