No layout for specific method


#1

Is there a way to not specify a layout for a particular method in a
controller?
In this particular instance, I am using the admin layout for the login
controller, but I don’t want the layout to be used on the “login”
method.

Thanks,

Dan


#2

Daniel W. wrote:

Is there a way to not specify a layout for a particular method in a
controller?
In this particular instance, I am using the admin layout for the login
controller, but I don’t want the layout to be used on the “login”
method.

Use this as the last line in your login method:

render :action => “login”, :layout => false

This will still cause your login.rhtml to be rendered but without the
surrounding layout.

Jeff
www.softiesonrails.com


#3

On 1/9/06, Daniel W. removed_email_address@domain.invalid wrote:

Is there a way to not specify a layout for a particular method in a
controller?
In this particular instance, I am using the admin layout for the login
controller, but I don’t want the layout to be used on the “login” method.

According to the docs you can do this:

layout nil, :only => :foo

or

layout ‘whatever’, :except => :foo

http://rails.rubyonrails.com/classes/ActionController/Layout/ClassMethods.html


rick
http://techno-weenie.net


#4

Rick O. wrote:

layout nil, :only => :foo

or

layout ‘whatever’, :except => :foo

http://rails.rubyonrails.com/classes/ActionController/Layout/ClassMethods.html

That’s cool, Rick. I didn’t know about the :except option before.

Jeff
www.softiesonrails.com


#5

Jeff C. wrote:

Use this as the last line in your login method:

Nice!!! Thanks Jeff.

Dan


#6

Jeff
www.softiesonrails.com

Nice!!! Thanks Jeff.

Dan

Oops!! Spoke to soon. With this I got a double render error.

This worked though.

layout “admin”, :except => :login

Dan