From d059fa6f0c923240ef39a372276a151827a6df5b Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sun, 20 Oct 2013 13:42:42 -0700 Subject: disconnect join_constraints from the instance --- activerecord/lib/active_record/associations/join_dependency.rb | 2 +- .../active_record/associations/join_dependency/join_association.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index 5d1e41dabf..0969fc4ebd 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -168,7 +168,7 @@ module ActiveRecord chain = child.reflection.chain foreign_table = node.table foreign_klass = node.base_klass - child.join_constraints(foreign_table, foreign_klass, child.join_type, child.tables, child.reflection.scope_chain, chain) + child.join_constraints(foreign_table, foreign_klass, child, child.join_type, child.tables, child.reflection.scope_chain, chain) .concat make_joins(child) } end diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb index 7420e0df72..4a70dc9e26 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -25,7 +25,7 @@ module ActiveRecord super && reflection == other.reflection end - def join_constraints(foreign_table, foreign_klass, join_type, tables, scope_chain, chain) + def join_constraints(foreign_table, foreign_klass, node, join_type, tables, scope_chain, chain) joins = [] tables = tables.reverse @@ -52,7 +52,7 @@ module ActiveRecord if item.is_a?(Relation) item else - ActiveRecord::Relation.create(klass, table).instance_exec(self, &item) + ActiveRecord::Relation.create(klass, table).instance_exec(node, &item) end end -- cgit v1.2.3