Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Always expand */*

  • Loading branch information...
commit 0a1ba4eab0c442f3e9f4027e4b5d3418f8eb6ca4 1 parent fadd1fa
@josevalim josevalim authored
View
11 actionpack/lib/action_view/lookup_context.rb
@@ -167,15 +167,12 @@ def freeze_formats(formats, unless_frozen=false) #:nodoc:
@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
View
2  actionpack/test/template/lookup_context_test.rb
@@ -53,7 +53,7 @@ def teardown
test "handles explicitly defined */* formats fallback to :js" do
@lookup_context.formats = [:js, Mime::ALL]
- assert_equal [:js, :html], @lookup_context.formats
+ assert_equal [:js, *Mime::SET.symbols], @lookup_context.formats
end
test "adds :html fallback to :js formats" do
Please sign in to comment.
Something went wrong with that request. Please try again.