aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-01-16 19:51:50 +0000
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-16 13:43:54 -0800
commit8aedd722e119770908eb3956ad91f4c88f425eb5 (patch)
tree5db30d262005f36e8c31dfc91680ea5e26f5c79b
parentb7594a075637f2d3039b066c282acfcb32126cdf (diff)
downloadrails-8aedd722e119770908eb3956ad91f4c88f425eb5.tar.gz
rails-8aedd722e119770908eb3956ad91f4c88f425eb5.tar.bz2
rails-8aedd722e119770908eb3956ad91f4c88f425eb5.zip
Use self.target= in HasOneThroughAssociation too
-rw-r--r--activerecord/lib/active_record/associations/has_one_through_association.rb7
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