aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-02-18 22:21:31 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-02-18 23:17:45 +0900
commit5c6d6fd30af2208a86f97ce0ca303c6c59700246 (patch)
tree134bc30c756f3cb7b3d360d96cccdbc887f8c75d /activerecord/lib
parent6516eb774b0d964f824f05a24d71fc3f46e70741 (diff)
downloadrails-5c6d6fd30af2208a86f97ce0ca303c6c59700246.tar.gz
rails-5c6d6fd30af2208a86f97ce0ca303c6c59700246.tar.bz2
rails-5c6d6fd30af2208a86f97ce0ca303c6c59700246.zip
Association scope's own order should be prioritized over through scope's order
3acc5d6 was changed the order of scope evaluation from through scope to the association's own scope to be prioritized over the through scope. But the sorting order will be prioritized that is evaluated first. It is unintentional effect, association scope's sorting order should be prioritized as well. Fixes #32008.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/association_scope.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb
index 3d787b7da2..ad41ec8d2f 100644
--- a/activerecord/lib/active_record/associations/association_scope.rb
+++ b/activerecord/lib/active_record/associations/association_scope.rb
@@ -131,7 +131,7 @@ module ActiveRecord
item = eval_scope(reflection, scope_chain_item, owner)
if scope_chain_item == chain_head.scope
- scope.merge! item.except(:where, :includes)
+ scope.merge! item.except(:where, :includes, :unscope, :order)
end
reflection.all_includes do
@@ -140,7 +140,7 @@ module ActiveRecord
scope.unscope!(*item.unscope_values)
scope.where_clause += item.where_clause
- scope.order_values |= item.order_values
+ scope.order_values = item.order_values | scope.order_values
end
end