instance method
caching?
Ruby on Rails 8.0.4
Since v7.0.10Signature
caching?()
Returns whether the current view fragment is within a cache block.
Useful when certain fragments aren’t cacheable:
<% cache project do %> <% raise StandardError, "Caching private data!" if caching? %> <% end %>
Source
# File actionview/lib/action_view/helpers/cache_helper.rb, line 196
def caching?
CachingRegistry.caching?
end
Defined in actionview/lib/action_view/helpers/cache_helper.rb line 196
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::CacheHelper