Skip to content
  • John Hawthorn's avatar
    42d75ed3
    Only add template options when rendering template · 42d75ed3
    John Hawthorn authored
    Previously Action View was hooking in to _normalize_options to add
    :layout, :partial, and :prefix keys to the render options. These were
    added whether or not we were rendering a view template.
    
    This commit avoids adding those keys unless we are rendering a template.
    
    This improves performance both by avoiding calculating the templates to
    put into this options hash as well as enabling a fast path in `render
    json:`, which can only be used when `.to_json` is given no options.
    42d75ed3
    Only add template options when rendering template
    John Hawthorn authored
    Previously Action View was hooking in to _normalize_options to add
    :layout, :partial, and :prefix keys to the render options. These were
    added whether or not we were rendering a view template.
    
    This commit avoids adding those keys unless we are rendering a template.
    
    This improves performance both by avoiding calculating the templates to
    put into this options hash as well as enabling a fast path in `render
    json:`, which can only be used when `.to_json` is given no options.
Loading