instance method caching?

Ruby on Rails 7.2.3

Since v7.0.10

Available in: v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

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

Type at least 2 characters to search.

↑↓ navigate · open · esc close