aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorPaul Nikitochkin <paul.nikitochkin@gmail.com>2013-12-22 18:18:40 +0200
committerPaul Nikitochkin <paul.nikitochkin@gmail.com>2013-12-23 15:44:48 +0200
commit2bcf7158d346e1b619aebbbec360ee0153ef8d06 (patch)
treec6ada73df4d56a65a9d4ddd5d94c9ae7a53d6333 /activerecord/test/cases
parent00fc64a6dce4930e5f762c1c1d742addc0cf9e42 (diff)
downloadrails-2bcf7158d346e1b619aebbbec360ee0153ef8d06.tar.gz
rails-2bcf7158d346e1b619aebbbec360ee0153ef8d06.tar.bz2
rails-2bcf7158d346e1b619aebbbec360ee0153ef8d06.zip
On destroying do not touch destroyed belongs to association.
Fixes: #13445
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/belongs_to_associations_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb
index 6d01fcf50c..3205d0c28b 100644
--- a/activerecord/test/cases/associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -356,6 +356,14 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase
assert_queries(2) { line_item.destroy }
end
+ def test_belongs_to_with_touch_option_on_destroy_with_destroyed_parent
+ line_item = LineItem.create!
+ invoice = Invoice.create!(line_items: [line_item])
+ invoice.destroy
+
+ assert_queries(1) { line_item.destroy }
+ end
+
def test_belongs_to_with_touch_option_on_touch_and_reassigned_parent
line_item = LineItem.create!
Invoice.create!(line_items: [line_item])