1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Don't pass unneeded reflection to add_constraints

Because `refl.scope` is the same meaning with `chain_head.scope`.
This commit is contained in:
Ryuta Kamizono 2017-09-05 06:19:23 +09:00
parent e71d3cab81
commit 6b509dd18c

View file

@ -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