instance method
caching?
Ruby on Rails 7.0.10
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 188
def caching?
CachingRegistry.caching?
end
Defined in actionview/lib/action_view/helpers/cache_helper.rb line 188
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::CacheHelper