diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-11 16:39:14 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-11 16:39:14 -0700 |
commit | 5bef5cfd448d41d61f6794ace5188efc16daab65 (patch) | |
tree | 2a808541a0855d1bb16f7144e5747947da64a8a8 /activerecord | |
parent | 5d663a712297f0c62ea948cbe2765e6acac839ab (diff) | |
download | rails-5bef5cfd448d41d61f6794ace5188efc16daab65.tar.gz rails-5bef5cfd448d41d61f6794ace5188efc16daab65.tar.bz2 rails-5bef5cfd448d41d61f6794ace5188efc16daab65.zip |
fix variable name. we're constructing a model, not an association
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index 58c315f48b..54dcd67590 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -213,31 +213,31 @@ module ActiveRecord parent.children.each do |node| primary_id = type_caster.type_cast row[primary_key] if ar_parent.id == primary_id - association = construct_association(ar_parent, node, row) - construct(association, node, row, rs) if association + model = construct_model(ar_parent, node, row) + construct(model, node, row, rs) if model end end end - def construct_association(record, join_part, row) + def construct_model(record, join_part, row) if join_part.reflection.collection? - association = join_part.instantiate(row) unless row[join_part.aliased_primary_key].nil? + model = join_part.instantiate(row) unless row[join_part.aliased_primary_key].nil? other = record.association(join_part.reflection.name) other.loaded! - other.target.push(association) if association - other.set_inverse_instance(association) + other.target.push(model) if model + other.set_inverse_instance(model) else return record.association(join_part.reflection.name).target if record.association_cache.key?(join_part.reflection.name) - association = join_part.instantiate(row) unless row[join_part.aliased_primary_key].nil? - set_target_and_inverse(join_part, association, record) + model = join_part.instantiate(row) unless row[join_part.aliased_primary_key].nil? + set_target_and_inverse(join_part, model, record) end - association + model end - def set_target_and_inverse(join_part, association, record) + def set_target_and_inverse(join_part, model, record) other = record.association(join_part.reflection.name) - other.target = association - other.set_inverse_instance(association) + other.target = model + other.set_inverse_instance(model) end end end |