aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-10-10 14:50:12 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-10-10 14:50:12 -0700
commitff5f328bdfdd3dffd31bd74adac9d1e6e7f241fd (patch)
tree0df65c2bed6a77c365a249942a9e8fd293e96060 /activerecord/lib
parent223082e588af59cb35108ce2a2d742dcecf72cc6 (diff)
downloadrails-ff5f328bdfdd3dffd31bd74adac9d1e6e7f241fd.tar.gz
rails-ff5f328bdfdd3dffd31bd74adac9d1e6e7f241fd.tar.bz2
rails-ff5f328bdfdd3dffd31bd74adac9d1e6e7f241fd.zip
delete unused code
Now that we merge trees from the top down, we don't need to search through the whole tree for particular nodes, just walk it and merge.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb40
-rw-r--r--activerecord/lib/active_record/associations/join_dependency/join_part.rb10
2 files changed, 0 insertions, 50 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)
diff --git a/activerecord/lib/active_record/associations/join_dependency/join_part.rb b/activerecord/lib/active_record/associations/join_dependency/join_part.rb
index 7175dff5ac..0bd47a3646 100644
--- a/activerecord/lib/active_record/associations/join_dependency/join_part.rb
+++ b/activerecord/lib/active_record/associations/join_dependency/join_part.rb
@@ -40,16 +40,6 @@ module ActiveRecord
self.class == other.class
end
- def parents
- parents = []
- node = parent
- while node
- parents.unshift node
- node = node.parent
- end
- parents
- end
-
def each(&block)
yield self
children.each { |child| child.each(&block) }