aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2019-01-14 15:18:12 -0500
committerRafael Mendonça França <rafaelmfranca@gmail.com>2019-01-17 16:08:31 -0500
commite70d3df7c9b05c129b0fdcca57f66eca316c5cfc (patch)
treed563ce2152a3e4c7301292f36562a0f229a6d2b9 /actionpack
parent13ddc92e079e59a0b894e31bf5bb4fdecbd235d1 (diff)
downloadrails-e70d3df7c9b05c129b0fdcca57f66eca316c5cfc.tar.gz
rails-e70d3df7c9b05c129b0fdcca57f66eca316c5cfc.tar.bz2
rails-e70d3df7c9b05c129b0fdcca57f66eca316c5cfc.zip
Remove deprecated `fragment_cache_key` helper in favor of `combined_fragment_cache_key`
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG.md4
-rw-r--r--actionpack/lib/abstract_controller/caching/fragments.rb19
-rw-r--r--actionpack/test/controller/caching_test.rb8
3 files changed, 4 insertions, 27 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index c24bd3344e..94cd719ce9 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,3 +1,7 @@
+* Remove deprecated `fragment_cache_key` helper in favor of `combined_fragment_cache_key`.
+
+ *Rafael Mendonça França*
+
* Remove deprecated methods in `ActionDispatch::TestResponse`.
`#success?`, `missing?` and `error?` were deprecated in Rails 5.2 in favor of
diff --git a/actionpack/lib/abstract_controller/caching/fragments.rb b/actionpack/lib/abstract_controller/caching/fragments.rb
index 95078a2a28..4e454adc5f 100644
--- a/actionpack/lib/abstract_controller/caching/fragments.rb
+++ b/actionpack/lib/abstract_controller/caching/fragments.rb
@@ -61,25 +61,6 @@ module AbstractController
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 begin with <tt>views/</tt>,
- # followed by any controller-wide key prefix values, ending
- # with the specified +key+ value. The key is expanded using
- # ActiveSupport::Cache.expand_cache_key.
- def fragment_cache_key(key)
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
- 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.
- MSG
-
- 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
-
- # Given a key (as described in +expire_fragment+), returns
# a key array suitable for use in reading, writing, or expiring a
# cached fragment. All keys begin with <tt>:views</tt>,
# followed by <tt>ENV["RAILS_CACHE_ID"]</tt> or <tt>ENV["RAILS_APP_VERSION"]</tt> if set,
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb
index 6fe036dd15..5543f9120f 100644
--- a/actionpack/test/controller/caching_test.rb
+++ b/actionpack/test/controller/caching_test.rb
@@ -60,14 +60,6 @@ class FragmentCachingTest < ActionController::TestCase
@m2v2 = ModelWithKeyAndVersion.new("model/2", "2")
end
- def test_fragment_cache_key
- assert_deprecated do
- assert_equal "views/what a key", @controller.fragment_cache_key("what a key")
- assert_equal "views/test.host/fragment_caching_test/some_action",
- @controller.fragment_cache_key(controller: "fragment_caching_test", action: "some_action")
- end
- end
-
def test_combined_fragment_cache_key
assert_equal [ :views, "what a key" ], @controller.combined_fragment_cache_key("what a key")
assert_equal [ :views, "test.host/fragment_caching_test/some_action" ],