Permalink
Browse files

clean up add_constraints signature

  • Loading branch information...
1 parent a35325e commit db3f50c767f3933a43c23ec3a7b9ef02668d048a @tenderlove tenderlove committed Feb 14, 2014
Showing with 9 additions and 8 deletions.
  1. +9 −8 activerecord/lib/active_record/associations/association_scope.rb
@@ -9,15 +9,13 @@ def initialize(association)
end
def scope
- klass = association.klass
+ klass = association.klass
reflection = association.reflection
- scope = klass.unscoped
- scope.extending! Array(reflection.options[:extend])
+ scope = klass.unscoped
+ owner = association.owner
- owner = association.owner
- scope_chain = reflection.scope_chain
- chain = reflection.chain
- add_constraints(scope, owner, scope_chain, chain, klass, reflection)
+ scope.extending! Array(reflection.options[:extend])
+ add_constraints(scope, owner, klass, reflection)
end
def join_type
@@ -62,7 +60,10 @@ def bind(scope, table_name, column_name, value)
bind_value scope, column, value
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)
chain.each_with_index do |reflection, i|

0 comments on commit db3f50c

Please sign in to comment.