diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2019-02-25 11:58:19 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2019-02-25 12:26:30 -0800 |
commit | bc74959aad2073b294f537b0e928e0bbc23abfea (patch) | |
tree | cc053eeb2923390363e42f4df2bc03c4882f5d6f /actionview | |
parent | 2f128a82e66f181577ff77d83d4ca02659aa8a8d (diff) | |
download | rails-bc74959aad2073b294f537b0e928e0bbc23abfea.tar.gz rails-bc74959aad2073b294f537b0e928e0bbc23abfea.tar.bz2 rails-bc74959aad2073b294f537b0e928e0bbc23abfea.zip |
Dereference the format type before template construction
The format should always be exactly one symbol. Now we don't need to
check whether or not the format is a `Type` in the constructor.
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/template.rb | 2 | ||||
-rw-r--r-- | actionview/lib/action_view/template/resolver.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index 9e8f17d746..ffc3a7362e 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -149,7 +149,7 @@ module ActionView end @updated_at = details[:updated_at] || Time.now - @formats = Array(format).map { |f| f.respond_to?(:ref) ? f.ref : f } + @formats = Array(format) @variants = [details[:variant]] @compile_mutex = Mutex.new end diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb index 8232494746..220794e443 100644 --- a/actionview/lib/action_view/template/resolver.rb +++ b/actionview/lib/action_view/template/resolver.rb @@ -300,7 +300,7 @@ module ActionView handler = Template.handler_for_extension(extension) format, variant = pieces.last.split(EXTENSIONS[:variants], 2) if pieces.last format = if format - Template::Types[format] + Template::Types[format]&.ref else if handler.respond_to?(:default_format) # default_format can return nil handler.default_format |