aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-09-05 06:19:23 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-09-05 06:24:12 +0900
commit6b509dd18ca2a132342e9b850c00afc9b2a024b0 (patch)
tree6a04a5e59b38df5428e5cf17811604e7fe91c5ae /activerecord
parente71d3cab81af61b9b0874c87e55bce420d2aa617 (diff)
downloadrails-6b509dd18ca2a132342e9b850c00afc9b2a024b0.tar.gz
rails-6b509dd18ca2a132342e9b850c00afc9b2a024b0.tar.bz2
rails-6b509dd18ca2a132342e9b850c00afc9b2a024b0.zip
Don't pass unneeded `reflection` to `add_constraints`
Because `refl.scope` is the same meaning with `chain_head.scope`.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/association_scope.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb
index e790bd3db9..0e849c06ef 100644
--- a/activerecord/lib/active_record/associations/association_scope.rb
+++ b/activerecord/lib/active_record/associations/association_scope.rb
@@ -27,7 +27,7 @@ module ActiveRecord
chain_head, chain_tail = get_chain(reflection, association, alias_tracker)
scope.extending! reflection.extensions
- add_constraints(scope, owner, reflection, chain_head, chain_tail)
+ add_constraints(scope, owner, chain_head, chain_tail)
end
def join_type
@@ -126,7 +126,7 @@ module ActiveRecord
[runtime_reflection, previous_reflection]
end
- def add_constraints(scope, owner, refl, chain_head, chain_tail)
+ def add_constraints(scope, owner, chain_head, chain_tail)
owner_reflection = chain_tail
table = owner_reflection.alias_name
scope = last_chain_scope(scope, table, owner_reflection, owner)
@@ -146,7 +146,7 @@ module ActiveRecord
reflection.constraints.each do |scope_chain_item|
item = eval_scope(reflection, table, scope_chain_item, owner)
- if scope_chain_item == refl.scope
+ if scope_chain_item == chain_head.scope
scope.merge! item.except(:where, :includes)
end