Peter
Peter

Reputation: 447

In Rails, can I check in a view whether the action is to be cached?

I am using caches_page in controllers, like so: caches_page :index

Is there a way I can check in the view files whether the action is to be cached or not?

Thanks

Upvotes: 4

Views: 140

Answers (1)

flitzwald
flitzwald

Reputation: 20240

No, this is not possible. All the caches_page-method does is to register a block via after_filter without storing any additional information. If you need to know wether the current action is to be cached, you will have to provide a clue yourself by ie. an enhanced version of caches_page.

Upvotes: 2

Related Questions