Disabling a cache block?

From what I can tell, it is not possible to disable a fragment cache
block based on conditions. One use for this that comes to mind is to
not cache a particular fragment for admin users. Of course, I could
cache a version of the fragment specifically for admins

<% cache :admin => logged_in? && current_user.is_admin? do -%>

What I’m thinking of looks like this on the surface

<% cache {}, :disabled => logged_in? && current_user.is_admin? do -%>

and it wouldn’t be a big deal to implement. Only, I’m wondering whether
there’s another way to achieve the same out of the box.

Michael


Michael S.
mailto:[email protected]
http://www.schuerig.de/michael/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs