Permalink
Browse files

speed up finding existing nodes

The node must be a child of the parent passed in, so only search
children of the parent node
  • Loading branch information...
1 parent e73fbdf commit 4852a05ce66cedfa09a422fa601dd853f2070727 @tenderlove tenderlove committed Oct 9, 2013
Showing with 1 addition and 3 deletions.
  1. +1 −3 activerecord/lib/active_record/associations/join_dependency.rb
@@ -203,9 +203,7 @@ def find_or_build_scalar(reflection, parent, join_type)
end
def find_join_association(reflection, parent)
- join_associations.detect { |j|
- j.reflection == reflection && node_cmp(j.parent, parent)
- }
+ parent.children.find { |j| j.reflection == reflection }
end
def remove_uniq_by_reflection(reflection, records)

0 comments on commit 4852a05

Please sign in to comment.