diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-16 19:51:50 +0000 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-16 13:43:54 -0800 |
commit | 8aedd722e119770908eb3956ad91f4c88f425eb5 (patch) | |
tree | 5db30d262005f36e8c31dfc91680ea5e26f5c79b /activerecord | |
parent | b7594a075637f2d3039b066c282acfcb32126cdf (diff) | |
download | rails-8aedd722e119770908eb3956ad91f4c88f425eb5.tar.gz rails-8aedd722e119770908eb3956ad91f4c88f425eb5.tar.bz2 rails-8aedd722e119770908eb3956ad91f4c88f425eb5.zip |
Use self.target= in HasOneThroughAssociation too
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/has_one_through_association.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/has_one_through_association.rb b/activerecord/lib/active_record/associations/has_one_through_association.rb index 59a704b7bf..6c455c8716 100644 --- a/activerecord/lib/active_record/associations/has_one_through_association.rb +++ b/activerecord/lib/active_record/associations/has_one_through_association.rb @@ -4,10 +4,9 @@ module ActiveRecord class HasOneThroughAssociation < HasOneAssociation include ThroughAssociation - def replace(new_value) - create_through_record(new_value) - @target = new_value - loaded + def replace(record) + create_through_record(record) + self.target = record end private |