Permalink
Browse files

stop creating a bunch of relation objects when we can slap all the jo…

…ins on at once
  • Loading branch information...
1 parent ebe9cd8 commit 0061c5e1ef0f7be8946602456a538c263fcafed2 @tenderlove tenderlove committed Oct 10, 2013
@@ -80,9 +80,9 @@ def reflections
end
def join_relation(relation)
- join_root.inject(relation) do |rel,association|
- association.join_relation(rel)
- end
+ nodes = join_root.drop 1
+ nodes.each { |n| n.join_type = Arel::OuterJoin }
+ relation.joins(nodes)
end
def join_constraints
@@ -125,11 +125,6 @@ def build_constraint(klass, table, key, foreign_table, foreign_key)
constraint
end
- def join_relation(joining_relation)
- self.join_type = Arel::OuterJoin
- joining_relation.joins(self)
- end
-
def table
tables.last
end

0 comments on commit 0061c5e

Please sign in to comment.