jxson
4/21/2009 - 7:35 PM

Rails nested layout example

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'