aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/belongs_to_associations_test.rb
diff options
context:
space:
mode:
authorTarmo Tänav <tarmo@itech.ee>2009-06-10 16:24:32 +0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-07-29 22:37:20 -0300
commit2ea922bcec333b6484a295b4fee1f4fa75c5704d (patch)
treed8505adef8028de6cd78d20038d36bea3715257c /activerecord/test/cases/associations/belongs_to_associations_test.rb
parentccd45618ed9a629c9535a5ff84ef5c238befa4ab (diff)
downloadrails-2ea922bcec333b6484a295b4fee1f4fa75c5704d.tar.gz
rails-2ea922bcec333b6484a295b4fee1f4fa75c5704d.tar.bz2
rails-2ea922bcec333b6484a295b4fee1f4fa75c5704d.zip
Don't increment and then decrement the same counter when re-assigning a belongs_to association
[#2786 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/test/cases/associations/belongs_to_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/belongs_to_associations_test.rb4
1 files changed, 4 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 4d5769d173..046433820d 100644
--- a/activerecord/test/cases/associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -215,6 +215,10 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase
r1.topic = Topic.find(t2.id)
+ assert_no_queries do
+ r1.topic = t2
+ end
+
assert r1.save
assert_equal 0, Topic.find(t1.id).replies.size
assert_equal 1, Topic.find(t2.id).replies.size