tags: update category cache whenever category changes.

Do `update_category_cache_for_all` in a callback instead of calling it
manually everywhere.
This commit is contained in:
evazion
2017-12-23 13:07:23 -06:00
parent 806513836b
commit 19bda2056c
5 changed files with 3 additions and 7 deletions

View File

@@ -112,11 +112,9 @@ class TagTest < ActiveSupport::TestCase
should "reset its category after updating" do
tag = FactoryGirl.create(:artist_tag)
tag.update_category_cache_for_all
assert_equal(Tag.categories.artist, Cache.get("tc:#{Cache.hash(tag.name)}"))
tag.update_attribute(:category, Tag.categories.copyright)
tag.update_category_cache_for_all
assert_equal(Tag.categories.copyright, Cache.get("tc:#{Cache.hash(tag.name)}"))
end