2 layouts per .rb page

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

use this in your actions:

render [blah-blah], :layout => “bla”

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.

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

Scott S. 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 ?

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

2006/4/20, Scott S. [email protected]:

Tell me if it works :

nice idea, but im gaining this error

NameError in AccountController#list

sorry for the typo :

controller.action_name

instead of

controler.action_name

-- Jean-François.

I am still having problems with this, has anyone else got any
suggestions?

2006/4/20, scott sherwood [email protected]:

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.

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