Module: ActsAsTaggableOn::Taggable::Cache
- Defined in:
- lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb', line 3 def self.included(base) # Skip adding caching capabilities if table not exists or no cache columns exist return unless base.table_exists? && base.tag_types.any? { |context| base.column_names.include?("cached_#{context.to_s.singularize}_list") } base.send :include, ActsAsTaggableOn::Taggable::Cache::InstanceMethods base.extend ActsAsTaggableOn::Taggable::Cache::ClassMethods base.class_eval do before_save :save_cached_tag_list end base.initialize_acts_as_taggable_on_cache end |