Module: Tagtical::Taggable::Cache::ClassMethods

Defined in:
lib/tagtical/taggable/cache.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_taggable(*args) ⇒ Object



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

def acts_as_taggable(*args)
  super(*args)
  initialize_tagtical_cache
end

#caching_tag_list_on?(context) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#initialize_tagtical_cacheObject



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

def initialize_tagtical_cache
  tag_types.each do |tag_type|
    class_eval <<-RUBY, __FILE__, __LINE__ + 1
      def self.caching_#{tag_type.singularize}_list?
        caching_tag_list_on?("#{tag_type}")
      end  
    RUBY
  end        
end