Dead simple nested layouts support for Rails. Does not monkey patch anything. Can nest as many layouts as desired.
gem 'rails_nestable_layouts'
# main layout, this line is not necessary. Note nested_layouts does not override the main layout.
layout :application
# accepts the same options as before_action/before_filter
nested_layouts 'layouts/secondary_layout', 'posts/layout', except: [:index]
<html>
<head></head>
<body>
<h1>My Main Layout</h1>
<!-- this will call the first nested layout , will fallback to normal functionality if no nested layouts. -->
<%= yield_nested %>
</body>
<footer></footer>
</html>
<h2>My Nested Layout</h2>
<%= yield_nested %> # this will call the next nested layout or the requested template if no more nested layouts.
Created by Weston Ganger - @westonganger