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:56:38 +0100
commitbbdb54ad153673a2733e109709f666bede1c61ac (patch)
treee4d277765ace5506865093763cf25832fc33e90c /actionpack
parente6e591dffcb2364e0da0c0fa15b192d5a0c65864 (diff)
downloadrails-bbdb54ad153673a2733e109709f666bede1c61ac.tar.gz
rails-bbdb54ad153673a2733e109709f666bede1c61ac.tar.bz2
rails-bbdb54ad153673a2733e109709f666bede1c61ac.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 20f75fba45..f7df9a6322 100644
--- a/actionpack/lib/action_view/renderer/template_renderer.rb
+++ b/actionpack/lib/action_view/renderer/template_renderer.rb
@@ -6,8 +6,13 @@ module ActionView
@view = context
@details = extract_details(options)
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