aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/renderer/template_renderer.rb4
-rw-r--r--actionpack/test/controller/render_test.rb1
2 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/renderer/template_renderer.rb b/actionpack/lib/action_view/renderer/template_renderer.rb
index f7df9a6322..ae923de24e 100644
--- a/actionpack/lib/action_view/renderer/template_renderer.rb
+++ b/actionpack/lib/action_view/renderer/template_renderer.rb
@@ -9,8 +9,8 @@ module ActionView
context = @lookup_context
unless context.rendered_format
- context.rendered_format = template.formats.first
- context.formats = template.formats
+ context.formats = template.formats unless template.formats.empty?
+ context.rendered_format = context.formats.first
end
render_template(template, options[:layout], options[:locals])
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index e1f9b7dc9c..fce13d096c 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -1022,6 +1022,7 @@ class RenderTest < ActionController::TestCase
def test_accessing_local_assigns_in_inline_template
get :accessing_local_assigns_in_inline_template, :local_name => "Local David"
assert_equal "Goodbye, Local David", @response.body
+ assert_equal "text/html", @response.content_type
end
def test_should_implicitly_render_html_template_from_xhr_request