diff --git a/actionpack/lib/action_view/renderer/abstract_renderer.rb b/actionpack/lib/action_view/renderer/abstract_renderer.rb index 1656cf7ec7..03feeff16c 100644 --- a/actionpack/lib/action_view/renderer/abstract_renderer.rb +++ b/actionpack/lib/action_view/renderer/abstract_renderer.rb @@ -12,7 +12,18 @@ module ActionView end protected - + + def extract_details(options) + details = {} + @lookup_context.registered_details.each do |key| + next unless value = options[key] + details[key] = Array.wrap(value) + end + details + end + + + def extract_format(value, details) if value.is_a?(String) && value.sub!(formats_regexp, "") ActiveSupport::Deprecation.warn "Passing the format in the template name is deprecated. " \ diff --git a/actionpack/lib/action_view/renderer/template_renderer.rb b/actionpack/lib/action_view/renderer/template_renderer.rb index f3e7378f2b..ac91d333ba 100644 --- a/actionpack/lib/action_view/renderer/template_renderer.rb +++ b/actionpack/lib/action_view/renderer/template_renderer.rb @@ -5,7 +5,7 @@ module ActionView class TemplateRenderer < AbstractRenderer #:nodoc: def render(context, options) @view = context - @details = options.slice(:formats, :locale, :handlers) + @details = extract_details(options) extract_format(options[:file] || options[:template], @details) template = determine_template(options) freeze_formats(template.formats, true) diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index 634e1cdd9f..5637f3f42e 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -36,6 +36,7 @@ module RenderTestCases def test_render_file_with_format assert_equal "