diff options
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/lookup_context.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb index 02114f46da..f0ed3425de 100644 --- a/actionpack/lib/action_view/lookup_context.rb +++ b/actionpack/lib/action_view/lookup_context.rb @@ -167,15 +167,12 @@ module ActionView @frozen_formats = true end - # Overload formats= to reject ["*/*"] values. + # Overload formats= to expand ["*/*"] values and automatically + # add :html as fallback to :js. def formats=(values) if values - values.pop if values.last == "*/*" - if values.size == 0 - values = nil - elsif values == [:js] - values << :html - end + values.concat(_formats_defaults) if values.delete "*/*" + values << :html if values == [:js] end super(values) end |