aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2012-03-28 18:52:56 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2012-03-28 18:54:12 -0300
commit5747e53c92c3fbb52814c3313c489f2a208f685f (patch)
treee4470e01663f8f4b3a9b983eb8c5af713773224e
parentf369f7747186f9c619856a1f3004a4d5d6c94fd3 (diff)
downloadrails-5747e53c92c3fbb52814c3313c489f2a208f685f.tar.gz
rails-5747e53c92c3fbb52814c3313c489f2a208f685f.tar.bz2
rails-5747e53c92c3fbb52814c3313c489f2a208f685f.zip
Set proper rendered_format when doing render :inline
Closes #5632
-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 36c1e6a9e4..a27d5dd1b1 100644
--- a/actionpack/lib/action_view/renderer/template_renderer.rb
+++ b/actionpack/lib/action_view/renderer/template_renderer.rb
@@ -11,8 +11,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 a81c9a420a..85abf3248d 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -1017,6 +1017,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