aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_controller/caching/fragments.rb6
-rw-r--r--actionview/lib/action_view/helpers/cache_helper.rb8
-rw-r--r--actionview/test/template/render_test.rb4
3 files changed, 10 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/caching/fragments.rb b/actionpack/lib/action_controller/caching/fragments.rb
index 2694d4c12f..4e141659ee 100644
--- a/actionpack/lib/action_controller/caching/fragments.rb
+++ b/actionpack/lib/action_controller/caching/fragments.rb
@@ -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
diff --git a/actionview/lib/action_view/helpers/cache_helper.rb b/actionview/lib/action_view/helpers/cache_helper.rb
index e473aeaea9..18b2102d73 100644
--- a/actionview/lib/action_view/helpers/cache_helper.rb
+++ b/actionview/lib/action_view/helpers/cache_helper.rb
@@ -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:
diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb
index 84aca222b2..994fd44c52 100644
--- a/actionview/test/template/render_test.rb
+++ b/actionview/test/template/render_test.rb
@@ -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