mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove ActionView::Helpers::CacheHelper#fragment_cache_key
Introduced in e56c635427
, `CacheHelper#fragment_cache_key` is a duplicate of `ActionController::Caching::Fragments#fragment_cache_key`.
We now require the view to provide this method on its own (as with `view_cache_dependencies`); `ActionController::Caching::Fragments` exports its version as a `helper_method`.
This commit is contained in:
parent
dbf867cfcb
commit
1a404abc03
3 changed files with 10 additions and 8 deletions
|
@ -14,6 +14,12 @@ module ActionController
|
|||
#
|
||||
# expire_fragment('name_of_cache')
|
||||
module Fragments
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
helper_method :fragment_cache_key if respond_to?(:helper_method)
|
||||
end
|
||||
|
||||
# Given a key (as described in +expire_fragment+), returns
|
||||
# a key suitable for use in reading, writing, or expiring a
|
||||
# cached fragment. All keys are prefixed with <tt>views/</tt> and uses
|
||||
|
|
|
@ -216,14 +216,6 @@ module ActionView
|
|||
end
|
||||
end
|
||||
|
||||
# Given a key (as described in ActionController::Caching::Fragments.expire_fragment),
|
||||
# returns a key suitable for use in reading, writing, or expiring a
|
||||
# cached fragment. All keys are prefixed with <tt>views/</tt> and uses
|
||||
# ActiveSupport::Cache.expand_cache_key for the expansion.
|
||||
def fragment_cache_key(key)
|
||||
ActiveSupport::Cache.expand_cache_key(key.is_a?(Hash) ? url_for(key).split("://").last : key, :views)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def fragment_name_with_digest(name, virtual_path) #:nodoc:
|
||||
|
|
|
@ -9,6 +9,10 @@ module RenderTestCases
|
|||
@assigns = { :secret => 'in the sauce' }
|
||||
@view = Class.new(ActionView::Base) do
|
||||
def view_cache_dependencies; end
|
||||
|
||||
def fragment_cache_key(key)
|
||||
ActiveSupport::Cache.expand_cache_key(key, :views)
|
||||
end
|
||||
end.new(paths, @assigns)
|
||||
|
||||
@controller_view = TestController.new.view_context
|
||||
|
|
Loading…
Reference in a new issue