layout possibilities in rails

Layouts in rails can be accomplished in quite a few ways. Here are the most common:

  • layouts/application.html.erb #default for all controllers
  • layouts/my_controller.html.erb #layout for a controller with the same name
  • layout "my_layout" in controller # explicitly set layout in controller
  • layout :decide_on_layout # with ‘decide_on_layout being a method returning a layout name as string
  • render :layout => false # no layout at all
  • render :partial => ‘my_partial’, :layout => ‘my_other_partial’ # partials as layouts


Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>