aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/join_dependency.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/associations/join_dependency.rb')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb40
1 files changed, 0 insertions, 40 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb
index a25a061fc0..31867b6c88 100644
--- a/activerecord/lib/active_record/associations/join_dependency.rb
+++ b/activerecord/lib/active_record/associations/join_dependency.rb
@@ -61,30 +61,10 @@ module ActiveRecord
build tree, @join_root, Arel::InnerJoin
end
- def graft(associations)
- associations.reject { |join_node|
- find_node join_node
- }.each { |join_node|
- parent = find_node(join_node.parent) || join_root
- reflection = join_node.reflection
- type = join_node.join_type
-
- next if parent.children.find { |j| j.reflection == reflection }
- build_scalar reflection, parent, type
- }
- self
- end
-
def reflections
join_root.drop(1).map!(&:reflection)
end
- def outer_joins
- nodes = join_root.drop 1
- nodes.each { |n| n.join_type = Arel::OuterJoin }
- nodes
- end
-
def merge_outer_joins!(other)
left = join_root
right = other.join_root
@@ -148,26 +128,6 @@ module ActiveRecord
dup
end
- def find_node(target_node)
- stack = target_node.parents << target_node
-
- left = [join_root]
- right = stack.shift
-
- loop {
- match = left.find { |l| l.match? right }
-
- if match
- return match if stack.empty?
-
- left = match.children
- right = stack.shift
- else
- return nil
- end
- }
- end
-
def remove_duplicate_results!(base, records, associations)
associations.each do |node|
reflection = base.reflect_on_association(node.name)