diff --git a/lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb b/lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb index 6bec623de..5227ddf0e 100644 --- a/lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb +++ b/lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb @@ -2,7 +2,7 @@ module ActsAsTaggableOn::Taggable module Cache 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") } + return unless base.connected? && 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