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.
# File actionpack/lib/abstract_controller/caching/fragments.rb, line 69
def fragment_cache_key(key)
ActiveSupport::Deprecation.warn( Calling fragment_cache_key directly is deprecated and will be removed in Rails 6.0. All fragment accessors now use the combined_fragment_cache_key method that retains the key as an array, such that the caching stores can interrogate the parts for cache versions used in recyclable cache keys..squish)
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