jamiejackson

Nested Layout

Sep 10th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.55 KB | None | 0 0
  1. # /app/views/layouts/application.html.erb
  2. <!doctype html>
  3. <html>
  4. <head>
  5. </head>
  6. <body>
  7. <%= content_for?(:content) ? yield(:content) : yield %>
  8. </body>
  9. </html>
  10.  
  11. # /app/views/layouts/errors.html.erb
  12. <% content_for :content do %>
  13.   <fieldset title="foo">
  14.   <%= content_for?(:errors_content) ? yield(:errors_content) : yield %>
  15.   </fieldset>
  16. <% end %>
  17.  
  18. # /app/controllers/errors_controller.rb
  19. class ErrorsController < ApplicationController
  20.   def exception
  21.       render :template => "errors/500", :status => 500 # , :layout => "errors"
  22.   end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment