diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-11-15 12:21:04 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-11-15 12:21:04 -0800 |
commit | eeea1a26ec7bd5e11caa4630ff7820c1c7f762e3 (patch) | |
tree | 3b193dba9756b45e1a0a70d47faa4c3e2ff946a9 /activerecord/lib/active_record/associations/has_one_through_association.rb | |
parent | 1304b664924bfea54fd6dc0dc924ae3d126ff92d (diff) | |
parent | 4f984c9d0e66601a81cb5ae6e3b50582e6dc0c2d (diff) | |
download | rails-eeea1a26ec7bd5e11caa4630ff7820c1c7f762e3.tar.gz rails-eeea1a26ec7bd5e11caa4630ff7820c1c7f762e3.tar.bz2 rails-eeea1a26ec7bd5e11caa4630ff7820c1c7f762e3.zip |
Merge branch 'master' into testing
Diffstat (limited to 'activerecord/lib/active_record/associations/has_one_through_association.rb')
-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 b78bd5d931..8073ebaf9f 100644 --- a/activerecord/lib/active_record/associations/has_one_through_association.rb +++ b/activerecord/lib/active_record/associations/has_one_through_association.rb @@ -8,11 +8,10 @@ module ActiveRecord current_object = @owner.send(@reflection.through_reflection.name) if current_object - klass.destroy(current_object) - @owner.clear_association_cache + current_object.update_attributes(construct_join_attributes(new_value)) + else + @owner.send(@reflection.through_reflection.name, klass.send(:create, construct_join_attributes(new_value))) end - - @owner.send(@reflection.through_reflection.name, klass.send(:create, construct_join_attributes(new_value))) end private |