Module: MakeTaggable::Taggable::Cache::ClassMethods
- Defined in:
- lib/make_taggable/taggable/cache.rb
Overview
Added to a model once it has at least one caching column.
Instance Method Summary collapse
-
#caching_tag_list_on?(context) ⇒ TrueClass, FalseClass
Whether a context's tag list is cached on the model.
-
#initialize_tags_cache ⇒ void
Defines a
caching_<context>_list?predicate for each context. -
#make_taggable(*args) ⇒ void
Adds contexts and refreshes the caching predicates.
Instance Method Details
#caching_tag_list_on?(context) ⇒ TrueClass, FalseClass
Whether a context's tag list is cached on the model.
112 113 114 |
# File 'lib/make_taggable/taggable/cache.rb', line 112 def caching_tag_list_on?(context) column_names.include?("cached_#{context.to_s.singularize}_list") end |
#initialize_tags_cache ⇒ void
This method returns an undefined value.
Defines a caching_<context>_list? predicate for each context.
85 86 87 88 89 90 91 92 93 |
# File 'lib/make_taggable/taggable/cache.rb', line 85 def tag_types.map(&:to_s).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 |
#make_taggable(*args) ⇒ void
This method returns an undefined value.
Adds contexts and refreshes the caching predicates.
101 102 103 104 |
# File 'lib/make_taggable/taggable/cache.rb', line 101 def make_taggable(*args) super end |