Only define Impressionable::ClassMethods::DEFAULT_CACHE when undefined

Current behavior causes unnecessary warning messages to be issued when
using Impressionist with application preloaders such as spring.
This commit is contained in:
Geoff Harcourt 2013-12-28 15:01:39 -05:00
parent a974bd85b3
commit e3f86c8051
1 changed files with 7 additions and 1 deletions

View File

@ -5,7 +5,13 @@ module Impressionist
module ClassMethods module ClassMethods
attr_accessor :impressionist_cache_options attr_accessor :impressionist_cache_options
DEFAULT_CACHE = { :counter_cache => false, :column_name => :impressions_count, :unique => false } unless defined?(DEFAULT_CACHE)
DEFAULT_CACHE = {
:counter_cache => false,
:column_name => :impressions_count,
:unique => false
}
end
def impressionist_counter_cache_options def impressionist_counter_cache_options
@impressionist_cache_options ||= {} @impressionist_cache_options ||= {}