diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-14 14:04:39 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-14 14:04:39 -0800 |
commit | db3f50c767f3933a43c23ec3a7b9ef02668d048a (patch) | |
tree | 84ea64e0429c41d661e07f15caae45d3df38b4c9 | |
parent | a35325e32491d566fbb58001f8e68bed86d06955 (diff) | |
download | rails-db3f50c767f3933a43c23ec3a7b9ef02668d048a.tar.gz rails-db3f50c767f3933a43c23ec3a7b9ef02668d048a.tar.bz2 rails-db3f50c767f3933a43c23ec3a7b9ef02668d048a.zip |
clean up add_constraints signature
-rw-r--r-- | activerecord/lib/active_record/associations/association_scope.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index 2046d94a3d..9590d28129 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -9,15 +9,13 @@ module ActiveRecord 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 @@ module ActiveRecord 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| |