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

clean up add_constraints signature

This commit is contained in:
Aaron Patterson 2014-02-14 14:04:39 -08:00
parent a35325e324
commit db3f50c767

View file

@ -9,15 +9,13 @@ module ActiveRecord
end end
def scope def scope
klass = association.klass klass = association.klass
reflection = association.reflection reflection = association.reflection
scope = klass.unscoped scope = klass.unscoped
scope.extending! Array(reflection.options[:extend]) owner = association.owner
owner = association.owner scope.extending! Array(reflection.options[:extend])
scope_chain = reflection.scope_chain add_constraints(scope, owner, klass, reflection)
chain = reflection.chain
add_constraints(scope, owner, scope_chain, chain, klass, reflection)
end end
def join_type def join_type
@ -62,7 +60,10 @@ module ActiveRecord
bind_value scope, column, value bind_value scope, column, value
end end
def add_constraints(scope, owner, scope_chain, chain, assoc_klass, refl) def add_constraints(scope, owner, assoc_klass, refl)
chain = refl.chain
scope_chain = refl.scope_chain
tables = construct_tables(chain, assoc_klass, refl) tables = construct_tables(chain, assoc_klass, refl)
chain.each_with_index do |reflection, i| chain.each_with_index do |reflection, i|