From 2ae2728d78298030b1015497840b0519b5ed21a1 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Mon, 15 Jul 2013 11:17:25 -0700 Subject: Merge pull request #11451 from jetthoughts/11450_do_not_resave_destroyed_association Do not re-save destroyed association on saving parent object Conflicts: activerecord/lib/active_record/autosave_association.rb --- activerecord/test/cases/autosave_association_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activerecord/test/cases/autosave_association_test.rb') diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb index 6dbc419eb5..5556ab8fcc 100644 --- a/activerecord/test/cases/autosave_association_test.rb +++ b/activerecord/test/cases/autosave_association_test.rb @@ -734,6 +734,13 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase ids.each { |id| assert_nil klass.find_by_id(id) } end + def test_should_not_resave_destroyed_association + @pirate.birds.create!(name: :parrot) + @pirate.birds.first.destroy + @pirate.save! + assert @pirate.reload.birds.empty? + end + def test_should_skip_validation_on_has_many_if_marked_for_destruction 2.times { |i| @pirate.birds.create!(:name => "birds_#{i}") } -- cgit v1.2.3