Skip to content
This repository
Browse code

disconnect join_constraints from the instance

  • Loading branch information...
commit d059fa6f0c923240ef39a372276a151827a6df5b 1 parent fe67bc2
Aaron Patterson authored October 20, 2013
2  activerecord/lib/active_record/associations/join_dependency.rb
@@ -168,7 +168,7 @@ def make_joins(node)
168 168
           chain = child.reflection.chain
169 169
           foreign_table = node.table
170 170
           foreign_klass = node.base_klass
171  
-          child.join_constraints(foreign_table, foreign_klass, child.join_type, child.tables, child.reflection.scope_chain, chain)
  171
+          child.join_constraints(foreign_table, foreign_klass, child, child.join_type, child.tables, child.reflection.scope_chain, chain)
172 172
             .concat make_joins(child)
173 173
         }
174 174
       end
4  activerecord/lib/active_record/associations/join_dependency/join_association.rb
@@ -25,7 +25,7 @@ def match?(other)
25 25
           super && reflection == other.reflection
26 26
         end
27 27
 
28  
-        def join_constraints(foreign_table, foreign_klass, join_type, tables, scope_chain, chain)
  28
+        def join_constraints(foreign_table, foreign_klass, node, join_type, tables, scope_chain, chain)
29 29
           joins         = []
30 30
           tables        = tables.reverse
31 31
 
@@ -52,7 +52,7 @@ def join_constraints(foreign_table, foreign_klass, join_type, tables, scope_chai
52 52
               if item.is_a?(Relation)
53 53
                 item
54 54
               else
55  
-                ActiveRecord::Relation.create(klass, table).instance_exec(self, &item)
  55
+                ActiveRecord::Relation.create(klass, table).instance_exec(node, &item)
56 56
               end
57 57
             end
58 58
 

0 notes on commit d059fa6

Please sign in to comment.
Something went wrong with that request. Please try again.