diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-02-17 23:55:05 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-02-18 00:00:13 +0000 |
commit | 1644663ba7f678d178deab2bf1629dc05626f85b (patch) | |
tree | 27495a6b68feca350ba39e6f58522fa867f27197 /activerecord/lib/active_record/associations/class_methods/join_dependency.rb | |
parent | 1d9f26ed47ccb0a142551ebda5df263e51ad9774 (diff) | |
download | rails-1644663ba7f678d178deab2bf1629dc05626f85b.tar.gz rails-1644663ba7f678d178deab2bf1629dc05626f85b.tar.bz2 rails-1644663ba7f678d178deab2bf1629dc05626f85b.zip |
Split AssociationProxy into an Association class (and subclasses) which manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
Diffstat (limited to 'activerecord/lib/active_record/associations/class_methods/join_dependency.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/class_methods/join_dependency.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/associations/class_methods/join_dependency.rb b/activerecord/lib/active_record/associations/class_methods/join_dependency.rb index fdd4fe8946..89503ccafa 100644 --- a/activerecord/lib/active_record/associations/class_methods/join_dependency.rb +++ b/activerecord/lib/active_record/associations/class_methods/join_dependency.rb @@ -209,10 +209,10 @@ module ActiveRecord association = join_part.instantiate(row) case macro when :has_many, :has_and_belongs_to_many - collection = record.send(join_part.reflection.name) - collection.loaded! - collection.target.push(association) - collection.send(:set_inverse_instance, association) + other = record.association(join_part.reflection.name) + other.loaded! + other.target.push(association) + other.set_inverse_instance(association) when :belongs_to set_target_and_inverse(join_part, association, record) else @@ -223,9 +223,9 @@ module ActiveRecord end def set_target_and_inverse(join_part, association, record) - association_proxy = record.send(:association_proxy, join_part.reflection.name) - association_proxy.target = association - association_proxy.send(:set_inverse_instance, association) + other = record.association(join_part.reflection.name) + other.target = association + other.set_inverse_instance(association) end end end |