aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-10-09 14:51:38 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-10-09 14:51:38 -0700
commit4852a05ce66cedfa09a422fa601dd853f2070727 (patch)
tree2e640fd8ff3567ebfb0e6a9146b409227ebe1497 /activerecord/lib
parente73fbdf804633f8e151a33e681f370dfa0fbb3a0 (diff)
downloadrails-4852a05ce66cedfa09a422fa601dd853f2070727.tar.gz
rails-4852a05ce66cedfa09a422fa601dd853f2070727.tar.bz2
rails-4852a05ce66cedfa09a422fa601dd853f2070727.zip
speed up finding existing nodes
The node must be a child of the parent passed in, so only search children of the parent node
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb
index fe0066bbe1..199d28426b 100644
--- a/activerecord/lib/active_record/associations/join_dependency.rb
+++ b/activerecord/lib/active_record/associations/join_dependency.rb
@@ -203,9 +203,7 @@ module ActiveRecord
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)