1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Clear cache after setting Template::Types delegate

details_cache_key already references Template::Types.symbols and view
resolvers cache based on default_formats and other values. This
previously wasn't an issue because no views had been looked up before
this was set. Now that we are building a regex from the values of
Template::Types.symbols we need to clear cache after changing this
setting.
This commit is contained in:
John Hawthorn 2020-05-20 18:38:00 -07:00
parent 827119c48b
commit 096d143c8c
3 changed files with 3 additions and 1 deletions

View file

@ -67,4 +67,5 @@ autoload :Mime, "action_dispatch/http/mime_type"
ActiveSupport.on_load(:action_view) do
ActionView::Base.default_formats ||= Mime::SET.symbols
ActionView::Template::Types.delegate_to Mime
ActionView::LookupContext::DetailsKey.clear
end

View file

@ -116,4 +116,5 @@ autoload :Mime, "action_dispatch/http/mime_type"
ActiveSupport.on_load(:action_view) do
ActionView::Base.default_formats ||= Mime::SET.symbols
ActionView::Template::Types.delegate_to Mime
ActionView::LookupContext::DetailsKey.clear
end

View file

@ -62,7 +62,7 @@ class PerRequestDigestCacheTest < ActiveSupport::TestCase
end
test "template digests are cleared before a request" do
assert_called(ActionView::LookupContext::DetailsKey, :clear) do
assert_called(ActionView::LookupContext::DetailsKey, :clear, times: 3) do
get "/customers"
assert_equal 200, last_response.status
end