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

@ -67,4 +67,5 @@ def self.eager_load!
ActiveSupport.on_load(:action_view) do
ActionView::Base.default_formats ||= Mime::SET.symbols
ActionView::Template::Types.delegate_to Mime
ActionView::LookupContext::DetailsKey.clear
end

@ -116,4 +116,5 @@ module Session
ActiveSupport.on_load(:action_view) do
ActionView::Base.default_formats ||= Mime::SET.symbols
ActionView::Template::Types.delegate_to Mime
ActionView::LookupContext::DetailsKey.clear
end

@ -62,7 +62,7 @@ def index
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