Module: MakeTaggable::Taggable::Cache

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

Overview

Keeps a rendered copy of a tag list in a column on the taggable itself, so a list can be shown without loading its tags.

Caching switches itself on for any context the model has a matching cached_<context>_list column for. Nothing else is required.

Examples:

Caching the default context

add_column :books, :cached_tag_list, :string

Defined Under Namespace

Modules: ClassMethods, Columns, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • base (Class)

    the model being made taggable



21
22
23
24
25
# File 'lib/make_taggable/taggable/cache.rb', line 21

def self.included(base)
  # When included, conditionally adds tag caching methods when the model
  #   has any "cached_#{tag_type}_list" column
  base.extend Columns
end