Permalink
Browse files

stuff the join dependency object in the "anything goes" hash.

  • Loading branch information...
1 parent e4ec9ce commit d20ccb7e632665b6661e82ae450e8180e3c085f9 @tenderlove tenderlove committed Oct 10, 2013
@@ -79,10 +79,10 @@ def reflections
join_root.drop(1).map!(&:reflection)
end
- def join_relation(relation)
+ def outer_joins
nodes = join_root.drop 1
nodes.each { |n| n.join_type = Arel::OuterJoin }
- relation.joins(nodes)
+ nodes
end
def join_constraints
@@ -267,7 +267,7 @@ def construct_relation_for_association_find(join_dependency)
def apply_join_dependency(relation, join_dependency)
relation = relation.except(:includes, :eager_load, :preload)
- relation = join_dependency.join_relation(relation)
+ relation = relation.joins join_dependency
if using_limitable_reflections?(join_dependency.reflections)
relation
@@ -94,7 +94,7 @@ def merge_joins
[])
relation.joins! rest
- @relation = join_dependency.join_relation(relation)
+ @relation = relation.joins join_dependency
end
end
@@ -928,7 +928,7 @@ def build_joins(manager, joins)
:string_join
when Hash, Symbol, Array
:association_join
- when ActiveRecord::Associations::JoinDependency::JoinAssociation
+ when ActiveRecord::Associations::JoinDependency
:stashed_join
when Arel::Nodes::Join
:join_node
@@ -950,7 +950,9 @@ def build_joins(manager, joins)
join_list
)
- join_dependency.graft(stashed_association_joins)
+ stashed_association_joins.each do |dep|
+ join_dependency.graft dep.outer_joins
+ end
joins = join_dependency.join_constraints

0 comments on commit d20ccb7

Please sign in to comment.