From 2bcf7158d346e1b619aebbbec360ee0153ef8d06 Mon Sep 17 00:00:00 2001 From: Paul Nikitochkin Date: Sun, 22 Dec 2013 18:18:40 +0200 Subject: On destroying do not touch destroyed belongs to association. Fixes: #13445 --- .../test/cases/associations/belongs_to_associations_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord/test/cases') 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]) -- cgit v1.2.3