From 6537e5044c16de60fe9ccedba9befe0f35b31079 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 10 Oct 2013 14:59:36 -0700 Subject: the parent node is on the stack, so use it we don't need to walk back up the node's parents when we have the parent on the stack --- activerecord/lib/active_record/associations/join_dependency.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index 57a281be05..b3fec5ae0c 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -186,14 +186,14 @@ module ActiveRecord def construct(ar_parent, parent, row, rs) parent.children.each do |node| - association = construct_association(ar_parent, node, row, rs) + association = construct_association(ar_parent, parent, node, row, rs) construct(association, node, row, rs) if association end 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] + def construct_association(record, parent, join_part, row, rs) + caster = rs.column_type(parent.aliased_primary_key) + row_id = caster.type_cast row[parent.aliased_primary_key] return if record.id != row_id -- cgit v1.2.3