Skip to content
Browse files

refactor outer join generation

  • Loading branch information...
1 parent 0480b8c commit 10b2aa28872b99db42d60c64a25a79daee651839 @tenderlove tenderlove committed Oct 21, 2013
Showing with 6 additions and 11 deletions.
  1. +6 −11 activerecord/lib/active_record/associations/join_dependency.rb
View
17 activerecord/lib/active_record/associations/join_dependency.rb
@@ -85,22 +85,17 @@ def apply_tables!(node)
end
def join_constraints(outer_joins)
- if outer_joins.any?
- oj = outer_joins.first
+ joins = make_joins join_root
+ joins.concat outer_joins.flat_map { |oj|
if join_root.match? oj.join_root
- joins = make_joins join_root
- joins + walk(join_root, oj.join_root)
+ walk join_root, oj.join_root
else
- make_joins(join_root) + outer_joins.flat_map { |join|
- join.join_root.children.flat_map { |child|
- make_the_joins(join_root, child)
- }
+ oj.join_root.children.flat_map { |child|
+ make_the_joins(join_root, child)
}
end
- else
- make_joins join_root
- end
+ }
end
class Aliases

0 comments on commit 10b2aa2

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