mbleigh/acts-as-taggable-on — pull request #438 by bf4 (2013-12-19 16:40:42+00:00)
Title: [#432][#403][#433][#422] Fix checking for column cache until db connects

Fix related to #432, #403, #433, #422

Summary: When ActsAsTaggableOn::Taggable::Cache is included, it conditionally adds tag caching methods when the model has any "cached_#{tag_type}_list" column

Details: ActiveRecord::Base.columns makes a database connection and caches the calculated
columns hash for the record as @columns. Since we don't want to add caching
methods until we confirm the presence of a caching column, and we don't
want to force opening a database connection when the class is loaded,
here we intercept and cache the call to :columns as @acts_as_taggable_on_columns
to mimic the underlying behavior. While processing this first call to columns,
we do the caching column check and dynamically add the class and instance methods

Also see
https://github.com/mbleigh/acts-as-taggable-on/issues/432#issuecomment-30769459