support disable_cache for Tag.categories_for

This commit is contained in:
r888888888
2017-03-17 18:41:33 -07:00
parent 5cef0321f2
commit f1ba075bea

View File

@@ -102,8 +102,14 @@ class Tag < ActiveRecord::Base
end
def categories_for(tag_names, options = {})
categories = Cache.get_multi(Array(tag_names), "tc") do |tag|
Tag.select_category_for(tag)
if options[:disable_caching]
Array(tag_names).map do |tag|
select_category_for(tag)
end
else
Cache.get_multi(Array(tag_names), "tc") do |tag|
Tag.select_category_for(tag)
end
end
end
end