aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2014-03-01 12:03:23 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2014-03-01 12:03:23 -0200
commitf60b5249194d71a5a7ad152332400af39543628f (patch)
tree48334f0fec1316bfb88e74561f65421d256f9ff8 /activerecord/test/cases
parentf1601073de55deb78d041645e74b04c4969345d7 (diff)
parent774160b9ad6908435bf3485e7ac98633deff76c6 (diff)
downloadrails-f60b5249194d71a5a7ad152332400af39543628f.tar.gz
rails-f60b5249194d71a5a7ad152332400af39543628f.tar.bz2
rails-f60b5249194d71a5a7ad152332400af39543628f.zip
Merge pull request #14234 from arthurnn/fix_trans_on_replace
Remove unnecessary db call when replacing.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index a86fb15719..49d3301044 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1242,6 +1242,16 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert_equal orig_accounts, firm.accounts
end
+ def test_replace_with_same_content
+ firm = Firm.first
+ firm.clients = []
+ firm.save
+
+ assert_queries(0, ignore_none: true) do
+ firm.clients = []
+ end
+ end
+
def test_transactions_when_replacing_on_persisted
good = Client.new(:name => "Good")
bad = Client.new(:name => "Bad", :raise_on_save => true)