rails/rails — pull request #7169 by HyveAG (2012-07-26 17:21:45+00:00)
Title: Add support for using the :layout option when calling render @variable

Currently in Rails, it is not possible to specify a :layout when
directly calling
render @variable
More specifically, the following code doesn't work:

render @variable, layout: 'different_layout'

This patch allows specifying a layout. To pass locals to the layout,
omit the locals: {} brackets. Thus, instead of writing

render 'variables/variable', layout: 'different_layout', locals:
{variable: @variable, some_local: 'foo'}

you can just write:

render @variable, layout: 'different_layout', some_local: 'foo'

One drawback is that a local may not be named "layout", else it won't
work. It is quite obvious though since locals are passed "inline"
(without the locals: {} brackets).