From eb19ca3457c7b9908c71376f9b3b4431fcd24c6f Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Wed, 11 Jul 2012 12:18:52 +0400 Subject: Common behavior with adding formats to lookup_context for TemplateRenderer and PartialRenderer --- actionpack/lib/action_view/renderer/template_renderer.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view/renderer/template_renderer.rb') diff --git a/actionpack/lib/action_view/renderer/template_renderer.rb b/actionpack/lib/action_view/renderer/template_renderer.rb index 3c1b11396a..156ad4e547 100644 --- a/actionpack/lib/action_view/renderer/template_renderer.rb +++ b/actionpack/lib/action_view/renderer/template_renderer.rb @@ -8,9 +8,10 @@ module ActionView template = determine_template(options) context = @lookup_context + prepend_formats(template.formats) + unless context.rendered_format - context.formats = template.formats unless template.formats.empty? - context.rendered_format = context.formats.first + context.rendered_format = template.formats.first || formats.last end render_template(template, options[:layout], options[:locals]) -- cgit v1.2.3