instance method
fragment_cache_key
Ruby on Rails 5.0.7.2
Since v5.0.7.2 Last seen in v5.2.8.1Signature
fragment_cache_key(key)
Given a key (as described in expire_fragment), returns a key suitable for use in reading, writing, or expiring a cached fragment. All keys begin with views/, followed by any controller-wide key prefix values, ending with the specified key value. The key is expanded using ActiveSupport::Cache.expand_cache_key.
Parameters
-
keyreq
Source
# File actionpack/lib/abstract_controller/caching/fragments.rb, line 64
def fragment_cache_key(key)
head = self.class.fragment_cache_keys.map { |k| instance_exec(&k) }
tail = key.is_a?(Hash) ? url_for(key).split("://").last : key
ActiveSupport::Cache.expand_cache_key([*head, *tail], :views)
end
Defined in actionpack/lib/abstract_controller/caching/fragments.rb line 64
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in AbstractController::Caching::Fragments