Hi, Is this possible ive got layout "loggedout_layout", :only => [:login, :logout] but I also want to do somthing like layout "loggedin_layout", :except => [:login, :logout] When the second one is introduced it seems to cancel out the first request, any suggestions how to get around this? Scott -- Posted via http://www.ruby-forum.com/.
use this in your actions: render [blah-blah], :layout => "bla"> --- Urspr?ngliche Nachricht --- > Von: Scott Sherwood <scott@urbandream.net> > An: rails@lists.rubyonrails.org > Betreff: [Rails] 2 layouts per .rb page > Datum: Thu, 20 Apr 2006 15:32:42 +0200 > > Hi, > > Is this possible > > ive got layout "loggedout_layout", :only => [:login, :logout] > > but I also want to do somthing like > layout "loggedin_layout", :except => [:login, :logout] > > When the second one is introduced it seems to cancel out the first > request, any suggestions how to get around this? > > Scott > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Hello Scott,> Is this possible > > ive got layout "loggedout_layout", :only => [:login, :logout] > > but I also want to do somthing like > layout "loggedin_layout", :except => [:login, :logout] > > When the second one is introduced it seems to cancel out the first > request, any suggestions how to get around this?Tell me if it works : class MyBeautifulController < ApplicationController layout :determine_layout # ... private def determine_layout if [:login, :logout].include?(controler.action_name) "loggedout_layout" else "loggedin_layout" end end end -- Jean-Fran?ois. -- ? la renverse.
> Tell me if it works :nice idea, but im gaining this error NameError in AccountController#list undefined local variable or method `controler'' for #<AccountController:0x38a7560> code layout :determine_layout private def determine_layout if [:login, :logout].include?(controler.action_name) "loggedout_layout" else "loggedin_layout" end end -- Posted via http://www.ruby-forum.com/.
Scott Sherwood wrote:>> Tell me if it works : > > nice idea, but im gaining this error> if [:login, :logout].include?(controler.action_name)2 ''l''s in controller.action_name Alan p.s. can''t you specify :only *and* :except in the same layout line ? -- Posted via http://www.ruby-forum.com/.
2006/4/20, Scott Sherwood <scott@urbandream.net>:> > Tell me if it works : > > nice idea, but im gaining this error > > NameError in AccountController#listsorry for the typo : controller.action_name instead of controler.action_name -- Jean-Fran?ois. -- ? la renverse.
same problem again undefined local variable or method `controller'' for #<AccountController:0x37da8e8> RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/controllers/account_controller.rb:14:in `determine_layout'' In response to> can''t you specify :only *and* :except in the same layout line ?totally new to ror, but I couldnt find a way to define 2 templates on one line -- Posted via http://www.ruby-forum.com/.
I am still having problems with this, has anyone else got any suggestions? -- Posted via http://www.ruby-forum.com/.
2006/4/20, scott sherwood <scott@urbandream.net>:> I am still having problems with this, has anyone else got any > suggestions?change this line if [:login, :logout].include?(controler.action_name) into : if %w(login logout).include?(params[:action]) but it''s not very nice to me. -- Jean-Fran?ois. -- ? la renverse.