diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-10 14:59:36 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-10 14:59:36 -0700 |
commit | 6537e5044c16de60fe9ccedba9befe0f35b31079 (patch) | |
tree | be8253f66d075d18468ad9ca29ef88261571aff1 /activerecord/lib/active_record | |
parent | c4d0e69ad25e596ae3617e8fe96b91097edbfedb (diff) | |
download | rails-6537e5044c16de60fe9ccedba9befe0f35b31079.tar.gz rails-6537e5044c16de60fe9ccedba9befe0f35b31079.tar.bz2 rails-6537e5044c16de60fe9ccedba9befe0f35b31079.zip |
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
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency.rb | 8 |
1 files 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 |