Reputation: 17981
I want to control whether to perform caching at runtime.
I wrote an admin action like the following to test the idea (trying to set it to true):
def togglecache
Rails.configuration.action_controller.perform_caching = true
render :index
end
However after setting it, caching is still not taking effect.
How to achieve this, if it is possible at all?
Upvotes: 3
Views: 446
Reputation: 1333
ActionController::Base.perform_caching = true
Rails.cache.clear
load 'app/controllers/name_controller.rb'
Upvotes: 1