switch to use Cache.get_multi for tag types
This commit is contained in:
@@ -102,9 +102,8 @@ class Tag < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def categories_for(tag_names, options = {})
|
def categories_for(tag_names, options = {})
|
||||||
Array(tag_names).inject({}) do |hash, tag_name|
|
categories = Cache.get_multi(Array(tag_names), "tc") do |tag|
|
||||||
hash[tag_name] = category_for(tag_name, options)
|
Tag.select_category_for(tag)
|
||||||
hash
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class TagSetPresenter < Presenter
|
|||||||
def inline_tag_list(template)
|
def inline_tag_list(template)
|
||||||
@tags.map do |tag_name|
|
@tags.map do |tag_name|
|
||||||
<<-EOS
|
<<-EOS
|
||||||
<span class="category-#{Tag.category_for(tag_name)}">
|
<span class="category-#{categories[tag_name]}">
|
||||||
#{template.link_to(tag_name.tr("_", " "), template.posts_path(tags: tag_name))}
|
#{template.link_to(tag_name.tr("_", " "), template.posts_path(tags: tag_name))}
|
||||||
</span>
|
</span>
|
||||||
EOS
|
EOS
|
||||||
|
|||||||
Reference in New Issue
Block a user