diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-03 23:19:29 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-04 11:58:43 -0300 |
commit | 87c8ce340c6c83342df988df247e9035393ed7a0 (patch) | |
tree | 76cc493c2199395ba965b0f4a3e9cd64a2c3fe98 /activerecord/test | |
parent | 37175a24bd508e2983247ec5d011d57df836c743 (diff) | |
download | rails-87c8ce340c6c83342df988df247e9035393ed7a0.tar.gz rails-87c8ce340c6c83342df988df247e9035393ed7a0.tar.bz2 rails-87c8ce340c6c83342df988df247e9035393ed7a0.zip |
Remove deprecated automatic counter caches on `has_many :through`
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/deprecated_counter_cache_on_has_many_through_test.rb | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/activerecord/test/cases/associations/deprecated_counter_cache_on_has_many_through_test.rb b/activerecord/test/cases/associations/deprecated_counter_cache_on_has_many_through_test.rb deleted file mode 100644 index 48f7ddbe83..0000000000 --- a/activerecord/test/cases/associations/deprecated_counter_cache_on_has_many_through_test.rb +++ /dev/null @@ -1,26 +0,0 @@ -require "cases/helper" - -class DeprecatedCounterCacheOnHasManyThroughTest < ActiveRecord::TestCase - class Post < ActiveRecord::Base - has_many :taggings, as: :taggable - has_many :tags, through: :taggings - end - - class Tagging < ActiveRecord::Base - belongs_to :taggable, polymorphic: true - belongs_to :tag - end - - class Tag < ActiveRecord::Base - end - - test "counter caches are updated in the database if the belongs_to association doesn't specify a counter cache" do - post = Post.create!(title: 'Hello', body: 'World!') - assert_deprecated { post.tags << Tag.create!(name: 'whatever') } - - assert_equal 1, post.tags.size - assert_equal 1, post.tags_count - assert_equal 1, post.reload.tags.size - assert_equal 1, post.reload.tags_count - end -end |