From 5a0cca739a42c60fc852b42eb2b36c457981dce2 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 8 Oct 2013 19:09:13 -0700 Subject: eliminate function that is only used in one place --- activerecord/lib/active_record/associations/join_dependency.rb | 9 ++------- 1 file 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 e42736ee8b..00321042a8 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -234,16 +234,11 @@ module ActiveRecord def construct(parent, nodes, row, rs) nodes.sort_by { |k| k.name }.each do |node| - assoc = node.children - association = construct_scalar(parent, row, rs, node) - construct(association, assoc, row, rs) if association + association = construct_association(parent, node.join_part, row, rs) + construct(association, node.children, row, rs) if association end end - def construct_scalar(parent, row, rs, node) - construct_association(parent, node.join_part, row, rs) - end - def construct_association(record, join_part, row, rs) caster = rs.column_type(join_part.parent.aliased_primary_key) row_id = caster.type_cast row[join_part.parent.aliased_primary_key] -- cgit v1.2.3