module ActionView::Helpers::CacheHelper
def cache_if(condition, name = {}, options = {}, &block)
<%= render project.topics %>
All the topics on this project
<% cache_if admin?, project do %>
Cache fragments of a view if +condition+ is true
def cache_if(condition, name = {}, options = {}, &block) if condition cache(name, options, &block) else yield end nil end