engage2245
engage2245

Reputation: 93

Access to config.action_controller.perform_caching value from inside a controller

Is it possible to check the value of:

config.action_controller.perform_caching

...from within ApplicationController?

I have some custom caching methods that should or shouldn't be called based on this value.

Upvotes: 2

Views: 993

Answers (2)

Kieran Pilkington
Kieran Pilkington

Reputation: 412

As of Rails 3.x, you can use this:

Rails.configuration.action_controller.perform_caching

Upvotes: 0

Simone Carletti
Simone Carletti

Reputation: 176472

ActionController::Base.perform_caching

returns true or false depending on whether the caching is enabled.

Upvotes: 1

Related Questions