Permalink
Browse files

pass in scope chain so reflection is not needed

  • Loading branch information...
1 parent e7bb4bb commit fe67bc2a86f86bdc9c01c4ae54025f46cb7f0f55 @tenderlove tenderlove committed Oct 20, 2013
@@ -168,7 +168,7 @@ def make_joins(node)
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, chain)
+ child.join_constraints(foreign_table, foreign_klass, child.join_type, child.tables, child.reflection.scope_chain, chain)
.concat make_joins(child)
}
end
@@ -25,11 +25,11 @@ def match?(other)
super && reflection == other.reflection
end
- def join_constraints(foreign_table, foreign_klass, join_type, tables, chain)
+ def join_constraints(foreign_table, foreign_klass, join_type, tables, scope_chain, chain)
joins = []
tables = tables.reverse
- scope_chain_iter = reflection.scope_chain.reverse_each
+ scope_chain_iter = scope_chain.reverse_each
# The chain starts with the target table, but we want to end with it here (makes
# more sense in this context), so we reverse

0 comments on commit fe67bc2

Please sign in to comment.