method
layout
layout(template_name, conditions = {}, auto = false)
public
Register or
log in
to add new notes.
chs -
August 7, 2008
rubymaverick -
June 30, 2008
george -
July 15, 2008
neves -
September 17, 2008
tomtt -
July 4, 2008
9 thanks
Function to Determine Layout
Sometimes its nice to have different layouts choosen automagicly:
class ApplicationController < ActionController::Base layout :determine_layout def determine_layout if is_admin? "admin" else "application" end ... end
8 thanks
7 thanks
Required Reading
The details for using layout (such as possible values for the conditions hash) can be found in ActionController::Layout::ClassMethods.
2 thanks
Turn layout off with render
Thats awkward, but the code below does not turn layout off:
render :action => "short_goal", :layout => nil
you must use false
render :action => "short_goal", :layout => false
2 thanks
Using a specific layout
To choose the layout (or no layout) for a method call the render method with a :layout option.

