I have the following two lines in my rails 3.2 application. The first one works, the second doesn't - the layout is not applied.
<%= render partial: 'question_pages/question_page', layout: 'layouts/question_page', locals: {question_page: question_page} %>
<%= render question_page, layout: 'layouts/question_page' %>
Any ideas on why I can't pass layout to render variable
?
Edited because of new answer: I patched Rails because I thought this wasn't possible, but the Rails devs told me better:
https://github.com/rails/rails/pull/7169
You can specify a layout by calling render partial: @variable, layout: 'somelayout'
. Whenever you include extra options, you have to specify partial:
.