aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorheruku <ukutaht@Ukus-MacBook-Pro.local>2013-11-24 03:47:17 -0600
committerdbc-apprentice <apprentice@devbootcamp.com>2013-11-26 09:04:03 -0600
commit45d4d141f971e50e2df40bbf3559ee254ebc81b9 (patch)
tree0e8a9680d7783324ba2e4020edfa943c921c48e9 /activerecord/test/cases
parent3669704050edfeb125d79a838d18584ec4a51a1a (diff)
downloadrails-45d4d141f971e50e2df40bbf3559ee254ebc81b9.tar.gz
rails-45d4d141f971e50e2df40bbf3559ee254ebc81b9.tar.bz2
rails-45d4d141f971e50e2df40bbf3559ee254ebc81b9.zip
changed update counter to act on unscoped model
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb8
1 files changed, 8 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 45bc974025..bfb80afa61 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1781,4 +1781,12 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert_equal [original_child], car.reload.failed_bulbs
end
+
+ test 'updates counter cache when default scope is given' do
+ topic = DefaultRejectedTopic.create approved: true
+
+ assert_difference "topic.reload.replies_count", 1 do
+ topic.approved_replies.create!
+ end
+ end
end