Skip to content

Instantly share code, notes, and snippets.

@rwoeber
Created April 26, 2014 07:36
Show Gist options
  • Select an option

  • Save rwoeber/11314156 to your computer and use it in GitHub Desktop.

Select an option

Save rwoeber/11314156 to your computer and use it in GitHub Desktop.
Simple nested_layout for rails
# via http://grosser.it/2010/02/25/simple-nested_layout-for-rails/
# application_helper.rb
def nested_layout(layout, &block)
@content_for_layout = capture(&block)
concat(render :file => layout)
end
# layouts/xxxx.erb
<% nested_layout 'layouts/application' do %>
Im nested...
<%= yield %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment