Module: ActsAsTaggableOn::Taggable::Caching

Extended by:
ActiveSupport::Concern
Defined in:
lib/acts-as-taggable-on/taggable/caching.rb

Instance Method Summary collapse

Instance Method Details

#save_cached_tag_listObject



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/acts-as-taggable-on/taggable/caching.rb', line 32

def save_cached_tag_list
  tag_types.map(&:to_s).each do |tag_type|
    next unless self.class.respond_to?("caching_#{tag_type.singularize}_list?")
    if self.class.send("caching_#{tag_type.singularize}_list?") && tag_list_cache_set_on(tag_type)
      list = tag_list_cache_on(tag_type).to_a.flatten.compact.join("#{ActsAsTaggableOn.delimiter} ")
      self["cached_#{tag_type.singularize}_list"] = list
    end
  end

  true
end