Module: MakeTaggable::Taggable::Cache::Columns

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

Overview

Intercepts the model's column lookup so caching can be wired up the first time the schema is known, without opening a database connection when the class is loaded.

Instance Method Summary collapse

Instance Method Details

#columnsArray<ActiveRecord::ConnectionAdapters::Column>

The model's columns, injecting the caching methods the first time they are asked for.

Returns:

  • (Array<ActiveRecord::ConnectionAdapters::Column>)


37
38
39
40
41
42
43
# File 'lib/make_taggable/taggable/cache.rb', line 37

def columns
  @make_taggable_cache_columns ||= begin
    db_columns = super
    _add_tags_caching_methods if _has_tags_cache_columns?(db_columns)
    db_columns
  end
end

#reset_column_informationvoid

This method returns an undefined value.

Forgets the cached column lookup along with Active Record's own.



50
51
52
53
# File 'lib/make_taggable/taggable/cache.rb', line 50

def reset_column_information
  super
  @make_taggable_cache_columns = nil
end