Is it possible to nest layouts in Rails 3.2? I’d like to create a generic layout used by application.html.erb and allow a couple views in the application to use it. I found the Nested Layouts ruby gem, but it hasn’t been updated in four years. It would be awesome if I could do something like the following in my application.html.erb file:
<% inside_layout 'html5_boilerplate' do %>
<div id="container">
<%= yield %>
</div>
<% end %>
I found an easy solution in this blog post.
In my
ApplicationHelper, I added the following:In application.html.erb, I added: