aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-10-08 19:06:49 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-10-08 19:06:49 -0700
commit99ff735eea6f5872042fcdd944bdde82de7ad3ce (patch)
treeefb5883d33aa063e239e52b7ce3b3e523cc8d7e8
parent4292f6051d215bcd77e927144c881fc82d1be049 (diff)
downloadrails-99ff735eea6f5872042fcdd944bdde82de7ad3ce.tar.gz
rails-99ff735eea6f5872042fcdd944bdde82de7ad3ce.tar.bz2
rails-99ff735eea6f5872042fcdd944bdde82de7ad3ce.zip
we will always detect the same node, so just pass the node in
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb
index f4bbdc7092..e42736ee8b 100644
--- a/activerecord/lib/active_record/associations/join_dependency.rb
+++ b/activerecord/lib/active_record/associations/join_dependency.rb
@@ -234,18 +234,13 @@ module ActiveRecord
def construct(parent, nodes, row, rs)
nodes.sort_by { |k| k.name }.each do |node|
- association_name = node.name
assoc = node.children
- association = construct_scalar(parent, association_name, row, rs, nodes)
+ association = construct_scalar(parent, row, rs, node)
construct(association, assoc, row, rs) if association
end
end
- def construct_scalar(parent, name, row, rs, nodes)
- node = nodes.detect { |j| j.name == name }
-
- raise(ConfigurationError, "No such association") unless node
-
+ def construct_scalar(parent, row, rs, node)
construct_association(parent, node.join_part, row, rs)
end