2 # Make :formats work when rendering one partial from another
4 # Taken from https://github.com/rails/rails/pull/6626
7 class AbstractRenderer #:nodoc:
8 def prepend_formats(formats)
9 formats = Array(formats)
10 return if formats.empty?
11 @lookup_context.formats = formats | @lookup_context.formats
16 def setup_with_formats(context, options, block)
17 prepend_formats(options[:formats])
18 setup_without_formats(context, options, block)
21 alias_method_chain :setup, :formats
24 class TemplateRenderer
25 def render_with_formats(context, options)
26 prepend_formats(options[:formats])
27 render_without_formats(context, options)
30 alias_method_chain :render, :formats