Skip to content

Instantly share code, notes, and snippets.

@pmarreck
Created August 1, 2012 15:39
Show Gist options
  • Save pmarreck/3227949 to your computer and use it in GitHub Desktop.
Save pmarreck/3227949 to your computer and use it in GitHub Desktop.
temporary caching control in a Rails 3.1+ world
def with_caching(on = true)
existing, Rails.application.config.action_controller.perform_caching = Rails.application.config.action_controller.perform_caching, on
yield
ensure
Rails.application.config.action_controller.perform_caching = existing
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment