Permalink
Browse files

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
  • Loading branch information...
1 parent c4d0e69 commit 6537e5044c16de60fe9ccedba9befe0f35b31079 @tenderlove tenderlove committed Oct 10, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 activerecord/lib/active_record/associations/join_dependency.rb
@@ -186,14 +186,14 @@ def build_join_association(reflection, parent, join_type)
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

0 comments on commit 6537e50

Please sign in to comment.