diff options
author | Subba Rao Pasupuleti <subbarao.pasupuleti@gmail.com> | 2010-07-14 04:39:54 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-07-18 11:31:29 +0200 |
commit | 4a0d7c1a439c6ad8d35bf514761824e51fa07df2 (patch) | |
tree | 460bf21f7214b3aaa9f33579f85f7b6e8d16b866 /activerecord/lib/active_record | |
parent | e210895ba95e498b9debbf43a3e5ae588bca81f0 (diff) | |
download | rails-4a0d7c1a439c6ad8d35bf514761824e51fa07df2.tar.gz rails-4a0d7c1a439c6ad8d35bf514761824e51fa07df2.tar.bz2 rails-4a0d7c1a439c6ad8d35bf514761824e51fa07df2.zip |
save on parent should not cascade to child unless child changed [#3353 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/autosave_association.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index 7517896235..6af384367f 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -372,7 +372,9 @@ module ActiveRecord if autosave && association.marked_for_destruction? association.destroy elsif autosave != false - saved = association.save(:validate => !autosave) if association.new_record? || autosave + if association.new_record? || ( autosave && association.changed? ) + saved = association.save(:validate => !autosave) + end if association.updated? association_id = association.send(reflection.options[:primary_key] || :id) |