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 Wright 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 -- Posted via http://www.ruby-forum.com/.
On 1/9/06, Daniel Wright <dw@wonderwave.net> 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
Jeff Cohen wrote:> Daniel Wright 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 > > >Nice!!!! Thanks Jeff. Dan
Rick Olson wrote:> layout nil, :only => :foo > > or > > layout ''whatever'', :except => :foo > > http://rails.rubyonrails.com/classes/ActionController/Layout/ClassMethods.htmlThat''s cool, Rick. I didn''t know about the :except option before. Jeff www.softiesonrails.com -- Posted via http://www.ruby-forum.com/.
> >> >> >> 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 >> >> >> > Nice!!!! Thanks Jeff. > > Dan >Oops!! Spoke to soon. With this I got a double render error. This worked though. layout "admin", :except => :login Dan