Module: ActsAsTaggableOn::Taggable::Cache::ClassMethods

Defined in:
lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_taggable_on(*args) ⇒ Object



28
29
30
31
# File 'lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb', line 28

def acts_as_taggable_on(*args)
  super(*args)
  intialize_acts_as_taggable_on_cache
end

#caching_tag_list_on?(context) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb', line 33

def caching_tag_list_on?(context)
  column_names.include?("cached_#{context.to_s.singularize}_list")
end

#intialize_acts_as_taggable_on_cacheObject



18
19
20
21
22
23
24
25
26
# File 'lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb', line 18

def intialize_acts_as_taggable_on_cache      
  tag_types.map(&:to_s).each do |tag_type|
    class_eval %(
      def self.caching_#{tag_type.singularize}_list?
        caching_tag_list_on?("#{tag_type}")
      end        
    )
  end        
end