diff options
author | David Verhasselt <david@crowdway.com> | 2014-05-23 13:46:03 +0300 |
---|---|---|
committer | David Verhasselt <david@crowdway.com> | 2014-06-10 11:18:52 +0300 |
commit | 63fd88ca5c255a84b61ce81c41dfe9928ea101d9 (patch) | |
tree | 88d1e1b8bbae64312aea3b83f02f2426e906624f /activerecord/test/cases/associations | |
parent | 90fb179cb3fb6f1decd7e42227cd8e0251832d7b (diff) | |
download | rails-63fd88ca5c255a84b61ce81c41dfe9928ea101d9.tar.gz rails-63fd88ca5c255a84b61ce81c41dfe9928ea101d9.tar.bz2 rails-63fd88ca5c255a84b61ce81c41dfe9928ea101d9.zip |
If a counter_cache exists, use it for #empty?
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 7 |
1 files changed, 7 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 5f01352ab4..a80be99720 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -807,6 +807,13 @@ class HasManyAssociationsTest < ActiveRecord::TestCase end end + def test_calling_empty_with_counter_cache + post = posts(:welcome) + assert_queries(0) do + assert_not post.comments.empty? + end + end + def test_custom_named_counter_cache topic = topics(:first) |