Johannes Emerich
2013-Oct-12 13:36 UTC
Feature Suggestion: Rendering templates with blocks
It would be nice to be able to use blocks when rendering templates, similar to partial layouts. With partial layouts, the following is possible (with `layouts/_special.html.erb`): <%= render layout: "layouts/special" do %> <foo>...</foo> <% end %> This requires the layout to be a _partial_ layout. It would be convenient however to have the same option when rendering any template: <%= render template: "layouts/application" do %> <div class="foo-wrap"><%= yield %></div> <% end %> The most obvious use case is creating a layout file adding some extra structure in the main content area of the application layout. This would seem to be a cleaner solution to nested layouts[1], since the application layout need not be changed. (The chaining/subtemplating considerations described in the guide would be unnecessary.) Thoughts? Best, Johannes [1]: http://guides.rubyonrails.org/layouts_and_rendering.html#using-nested-layouts -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.