From 71250a5ae575277379cc4fabf62baf60583ee0b9 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sun, 13 Oct 2013 18:01:18 -0700 Subject: unhook `join_constraints` from the @tables ivar --- 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(-) diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index ad1776fa5a..4635601781 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -119,7 +119,7 @@ module ActiveRecord def make_joins(node) node.children.flat_map { |child| - child.join_constraints(node).concat make_joins(child) + child.join_constraints(node, child.tables).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 d497709671..c6b45198ce 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -33,9 +33,9 @@ module ActiveRecord super && reflection == other.reflection end - def join_constraints(parent) + def join_constraints(parent, tables) joins = [] - tables = @tables.dup + tables = tables.dup foreign_table = parent.table foreign_klass = parent.base_klass -- cgit v1.2.3