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

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.
This commit is contained in:
Aaron Patterson 2019-02-25 11:58:19 -08:00
parent 2f128a82e6
commit bc74959aad
No known key found for this signature in database
GPG key ID: 953170BCB4FFAFC6
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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