module ActionView::Helpers::CacheHelper
def uncacheable!
<%= project_name_with_time(project) %>
<% cache project do %>
# Which will then raise if used within a +cache+ block:
end
"#{project.name} - #{Time.now}"
uncacheable!
def project_name_with_time(project)
Useful to denote helper methods that can't participate in fragment caching:
Raises +UncacheableFragmentError+ when called from within a +cache+ block.
def uncacheable! raise UncacheableFragmentError, "can't be fragment cached" if caching? end