aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/join_dependency.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-10-10 14:59:36 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-10-10 14:59:36 -0700
commit6537e5044c16de60fe9ccedba9befe0f35b31079 (patch)
treebe8253f66d075d18468ad9ca29ef88261571aff1 /activerecord/lib/active_record/associations/join_dependency.rb
parentc4d0e69ad25e596ae3617e8fe96b91097edbfedb (diff)
downloadrails-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/associations/join_dependency.rb')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb8
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