Skip to content

Instantly share code, notes, and snippets.

@jxson
Created April 21, 2009 19:35
Show Gist options
  • Select an option

  • Save jxson/99336 to your computer and use it in GitHub Desktop.

Select an option

Save jxson/99336 to your computer and use it in GitHub Desktop.
Rails nested layout example
# This is an example of how to use nested layouts in rails per the guide:
# http://guides.rubyonrails.org/layouts_and_rendering.html#using-nested-layouts
# in app/views/layouts/application.html.erb (instead of the standard yield)
yield(:content) or yield
# in app/views/layouts/special.html.erb
content_for :content do
# content..
end
render :file => "layouts/application.html.erb"
# in app/controllers/special_controller.rb
layout 'special'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment