instance method
uncacheable!
Ruby on Rails 7.2.3
Since v7.0.10Signature
uncacheable!()
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 %>
Source
# File actionview/lib/action_view/helpers/cache_helper.rb, line 205
def uncacheable!
raise UncacheableFragmentError, "can't be fragment cached" if caching?
end
Defined in actionview/lib/action_view/helpers/cache_helper.rb line 205
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::CacheHelper