I don’t know if it’s possible (you might be able to use ‘include
ActionController::Caching::Actions’ in the model) but I prefer my
cache expiration to be outside of the model and in sweeper files…
class DeclarationSweeper < ActionController::Caching::Sweeper
I don’t know if it’s possible (you might be able to use ‘include
ActionController::Caching::Actions’ in the model) but I prefer my
cache expiration to be outside of the model and in sweeper files…
class DeclarationSweeper < ActionController::Caching::Sweeper
observe Declaration
def after_create(page)
# expire something…
end
end
Thanks. But the cache I want to sweep is based on the data of two
different models. Is it possible to call the same method
(clean_balance_cache) in two different sweeper files? The method
consists of `expire_action’ and some other things.
I don’t know if it’s possible (you might be able to use ‘include
ActionController::Caching::Actions’ in the model) but I prefer my
cache expiration to be outside of the model and in sweeper files…
class DeclarationSweeper < ActionController::Caching::Sweeper
observe Declaration
def after_create(page)
# expire something…
end
end
Thanks. But the cache I want to sweep is based on the data of two
different models. Is it possible to call the same method
(clean_balance_cache) in two different sweeper files? The method
consists of `expire_action’ and some other things.
This worked:
class BalanceSweeper < ActionController::Caching::Sweeper
observe Declaration, Deposit
def after_create(data)
clean_balance_cache
end
def after_save(data)
clean_balance_cache
end
def after_destroy(data)
end
def clean_balance_cache #Expire the cache for the module right #expire_fragment(:controller => ‘application’, :action => ‘balans’)
expire_action :controller => ‘ajax’, :action => ‘module_balans’
end
end
Thanks!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.