aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
diff options
context:
space:
mode:
authorBrock Trappitt <brock.trappitt@gmail.com>2014-05-05 20:24:04 +0800
committerBrock Trappitt <brock.trappitt@gmail.com>2014-05-21 07:34:53 +0800
commit713fc39d93601043e027d5cd9ebcfa08064f9417 (patch)
treeea6e99031f03557f4d94a0b1361d79f0f739d8fe /activerecord/test/cases/associations
parent5508a3e5ca05d4c43232868f40ebd726d251eeac (diff)
downloadrails-713fc39d93601043e027d5cd9ebcfa08064f9417.tar.gz
rails-713fc39d93601043e027d5cd9ebcfa08064f9417.tar.bz2
rails-713fc39d93601043e027d5cd9ebcfa08064f9417.zip
Prevented belongs_to: touch propagating up if there are no changes being saved
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r--activerecord/test/cases/associations/belongs_to_associations_test.rb7
1 files changed, 7 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 3b484a0d64..dc7314b450 100644
--- a/activerecord/test/cases/associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -369,6 +369,13 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase
assert_queries(2) { line_item.update amount: 10 }
end
+ def test_belongs_to_with_touch_option_on_empty_update
+ line_item = LineItem.create!
+ Invoice.create!(line_items: [line_item])
+
+ assert_queries(0) { line_item.save }
+ end
+
def test_belongs_to_with_touch_option_on_destroy
line_item = LineItem.create!
Invoice.create!(line_items: [line_item])