aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorPaul Nikitochkin <paul.nikitochkin@gmail.com>2013-07-15 14:07:33 +0300
committerPaul Nikitochkin <paul.nikitochkin@gmail.com>2013-07-15 20:39:30 +0300
commit372e809667b37f11e232a762815211601859b8b5 (patch)
tree427dbffdd3f1dcbe1e1a191d27246727abfeadc7 /activerecord/test
parent0b61cc730ee1fd2b40acac5886a62ea91c0b3d51 (diff)
downloadrails-372e809667b37f11e232a762815211601859b8b5.tar.gz
rails-372e809667b37f11e232a762815211601859b8b5.tar.bz2
rails-372e809667b37f11e232a762815211601859b8b5.zip
Do not re-save destroyed association on saving parent object
Closes #11450
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/autosave_association_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb
index 580aa96ecd..635278abc1 100644
--- a/activerecord/test/cases/autosave_association_test.rb
+++ b/activerecord/test/cases/autosave_association_test.rb
@@ -705,6 +705,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}") }