diff options
-rw-r--r-- | actionview/lib/action_view/lookup_context.rb | 2 | ||||
-rw-r--r-- | actionview/test/template/lookup_context_test.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/actionview/lib/action_view/lookup_context.rb b/actionview/lib/action_view/lookup_context.rb index a0a2d41948..41751c2963 100644 --- a/actionview/lib/action_view/lookup_context.rb +++ b/actionview/lib/action_view/lookup_context.rb @@ -282,6 +282,8 @@ module ActionView if values values = values.compact values.concat(default_formats) if values.delete "*/*" + values.uniq! + if values == [:js] values << :html @html_fallback_for_js = true diff --git a/actionview/test/template/lookup_context_test.rb b/actionview/test/template/lookup_context_test.rb index 8b61302c32..ce5b4c4f66 100644 --- a/actionview/test/template/lookup_context_test.rb +++ b/actionview/test/template/lookup_context_test.rb @@ -72,7 +72,7 @@ class LookupContextTest < ActiveSupport::TestCase test "handles explicitly defined */* formats fallback to :js" do @lookup_context.formats = [:js, Mime::ALL] - assert_equal [:js, *Mime::SET.symbols], @lookup_context.formats + assert_equal [:js, *Mime::SET.symbols].uniq, @lookup_context.formats end test "adds :html fallback to :js formats" do |