diff options
author | Murray Steele <muz@h-lame.com> | 2009-12-17 11:38:44 +0000 |
---|---|---|
committer | Eloy Duran <eloy.de.enige@gmail.com> | 2009-12-28 15:12:11 +0100 |
commit | 6c8c85bc1eaf1639ea0df5f356e7105c74d128b2 (patch) | |
tree | 5a7199d8e473278e5580f73d47439f624e344c24 /activerecord/lib | |
parent | fc85c665271578e55e7fe90a721ca1533289d923 (diff) | |
download | rails-6c8c85bc1eaf1639ea0df5f356e7105c74d128b2.tar.gz rails-6c8c85bc1eaf1639ea0df5f356e7105c74d128b2.tar.bz2 rails-6c8c85bc1eaf1639ea0df5f356e7105c74d128b2.zip |
Add more tests for the various ways we can assign objects to associations. [#3513 state:resolved]
Get rid of a duplicate set_inverse_instance call if you use new_record(true) (e.g. you want to replace the existing instance).
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/has_one_association.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index 081d6233c4..ea769fd48b 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -121,10 +121,9 @@ module ActiveRecord else record[@reflection.primary_key_name] = @owner.id unless @owner.new_record? self.target = record + set_inverse_instance(record, @owner) end - set_inverse_instance(record, @owner) - record end |