Skip to content

Commit e70d3df

Browse files
committed
Remove deprecated fragment_cache_key helper in favor of combined_fragment_cache_key
1 parent 13ddc92 commit e70d3df

File tree

3 files changed

+4
-27
lines changed

3 files changed

+4
-27
lines changed

actionpack/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Remove deprecated `fragment_cache_key` helper in favor of `combined_fragment_cache_key`.
2+
3+
*Rafael Mendonça França*
4+
15
* Remove deprecated methods in `ActionDispatch::TestResponse`.
26

37
`#success?`, `missing?` and `error?` were deprecated in Rails 5.2 in favor of

actionpack/lib/abstract_controller/caching/fragments.rb

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,6 @@ def fragment_cache_key(value = nil, &key)
6060
end
6161
end
6262

63-
# Given a key (as described in +expire_fragment+), returns
64-
# a key suitable for use in reading, writing, or expiring a
65-
# cached fragment. All keys begin with <tt>views/</tt>,
66-
# followed by any controller-wide key prefix values, ending
67-
# with the specified +key+ value. The key is expanded using
68-
# ActiveSupport::Cache.expand_cache_key.
69-
def fragment_cache_key(key)
70-
ActiveSupport::Deprecation.warn(<<-MSG.squish)
71-
Calling fragment_cache_key directly is deprecated and will be removed in Rails 6.0.
72-
All fragment accessors now use the combined_fragment_cache_key method that retains the key as an array,
73-
such that the caching stores can interrogate the parts for cache versions used in
74-
recyclable cache keys.
75-
MSG
76-
77-
head = self.class.fragment_cache_keys.map { |k| instance_exec(&k) }
78-
tail = key.is_a?(Hash) ? url_for(key).split("://").last : key
79-
ActiveSupport::Cache.expand_cache_key([*head, *tail], :views)
80-
end
81-
8263
# Given a key (as described in +expire_fragment+), returns
8364
# a key array suitable for use in reading, writing, or expiring a
8465
# cached fragment. All keys begin with <tt>:views</tt>,

actionpack/test/controller/caching_test.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,6 @@ def setup
6060
@m2v2 = ModelWithKeyAndVersion.new("model/2", "2")
6161
end
6262

63-
def test_fragment_cache_key
64-
assert_deprecated do
65-
assert_equal "views/what a key", @controller.fragment_cache_key("what a key")
66-
assert_equal "views/test.host/fragment_caching_test/some_action",
67-
@controller.fragment_cache_key(controller: "fragment_caching_test", action: "some_action")
68-
end
69-
end
70-
7163
def test_combined_fragment_cache_key
7264
assert_equal [ :views, "what a key" ], @controller.combined_fragment_cache_key("what a key")
7365
assert_equal [ :views, "test.host/fragment_caching_test/some_action" ],

0 commit comments

Comments
 (0)