No layout for specific method

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

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

On 1/9/06, Daniel W. [email protected] 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

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

Jeff C. wrote:

Use this as the last line in your login method:

Nice!!! Thanks Jeff.

Dan

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs