method

uncacheable!

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActionView::Helpers::CacheHelper
uncacheable!() public

Raises UncacheableFragmentError when called from within a cache block.

Useful to denote helper methods that can’t participate in fragment caching:

def project_name_with_time(project)
  uncacheable!
  "#{project.name} - #{Time.now}"
end

# Which will then raise if used within a +cache+ block:
<% cache project do %>
  <%= project_name_with_time(project) %>
<% end %>
Show source
Register or log in to add new notes.