From b4f811dfbb97edcd57afb453f5ed4f374c4d2239 Mon Sep 17 00:00:00 2001 From: Joshua Kovach Date: Fri, 13 Sep 2013 15:52:18 -0400 Subject: [PATCH] Check to see if we can connect to the db before accessing it --- lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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