Sha256: 9bb529a41edb53f059d4ec94102e5aac94befe890df586f099d553328229b370
Contents?: true
Size: 1023 Bytes
Versions: 5
Compression:
Stored size: 1023 Bytes
Contents
module CacheSwitchingMacros def enable_cache(trigger=:all) before(trigger) do @__perform_caching_before ||= [] @__perform_caching_before.push Rails.application.config.action_controller.perform_caching Rails.application.config.action_controller.perform_caching = true end after(trigger) do @__perform_caching_before ||=[] previous_setting = @__perform_caching_before.pop || false Rails.application.config.action_controller.perform_caching = previous_setting end end def disable_cache(trigger=:all) before(trigger) do @__perform_caching_before ||= [] @__perform_caching_before.push Rails.application.config.action_controller.perform_caching Rails.application.config.action_controller.perform_caching = false end after(trigger) do @__perform_caching_before ||=[] previous_setting = @__perform_caching_before.pop || false Rails.application.config.action_controller.perform_caching = previous_setting end end end
Version data entries
5 entries across 5 versions & 1 rubygems