Module: CacheBack::ReloadAssociationMixin

Defined in:
lib/cache_back/reload_association_mixin.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



10
11
12
# File 'lib/cache_back/reload_association_mixin.rb', line 10

def self.included(base)
  base.alias_method_chain :reload, :cache_back_clearing
end

Instance Method Details

#reload_with_cache_back_clearing(*args) ⇒ Object



3
4
5
6
7
8
# File 'lib/cache_back/reload_association_mixin.rb', line 3

def reload_with_cache_back_clearing(*args)
  # TODO we could calculate the right key to clear by parsing the association conditions.
  # this would clear less keys
  CacheBack.cache.reset!
  reload_without_cache_back_clearing(*args)
end