aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-03-07 14:55:06 +0100
committerJosé Valim <jose.valim@gmail.com>2012-03-07 14:55:20 +0100
commitbcea8cd6d62f73cebc88256f7f54430c16f1b89d (patch)
treed102803aa91548dba19ead78038426c716ae1843 /actionpack
parent74fe7e1018585ed9ea086952f578079bb7577652 (diff)
downloadrails-bcea8cd6d62f73cebc88256f7f54430c16f1b89d.tar.gz
rails-bcea8cd6d62f73cebc88256f7f54430c16f1b89d.tar.bz2
rails-bcea8cd6d62f73cebc88256f7f54430c16f1b89d.zip
Just change the formats on first render, closes #5307, closes #5308.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/renderer/template_renderer.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/renderer/template_renderer.rb b/actionpack/lib/action_view/renderer/template_renderer.rb
index ddde990b72..36c1e6a9e4 100644
--- a/actionpack/lib/action_view/renderer/template_renderer.rb
+++ b/actionpack/lib/action_view/renderer/template_renderer.rb
@@ -8,8 +8,13 @@ module ActionView
@details = extract_details(options)
extract_format(options[:file] || options[:template], @details)
template = determine_template(options)
- @lookup_context.rendered_format ||= template.formats.first
- @lookup_context.formats = template.formats
+ context = @lookup_context
+
+ unless context.rendered_format
+ context.rendered_format = template.formats.first
+ context.formats = template.formats
+ end
+
render_template(template, options[:layout], options[:locals])
end