Newbie ruby string match question

All,

I want to know in the Application.rb controller if I’m on the login
screen.

When I’m on the page I care about the controller variable is
“#ActiveRbac::UserController:0x408b3d6c

So I want something like:
if controller contains ActiveRbac::UserController

What is the right syntax for the above?

Thanks
Greg

Greg F.
The Norcross Group
Forensics for the 21st Century

Controller and Action are passed in via the that params hash for every
request. Remember that rails does some url magic to make this

“/hello/world”

more or less mean this

“/dispatch.cgi?controller=hello&action=world”

So you can write a line like this:

do_something if params[:controller] == ‘hello’

Which will fire off on all requests to your HelloController.

Greg F. wrote:

All,

I want to know in the Application.rb controller if I’m on the login
screen.

When I’m on the page I care about the controller variable is
“#ActiveRbac::UserController:0x408b3d6c

So I want something like:
if controller contains ActiveRbac::UserController

What is the right syntax for the above?

Thanks
Greg

Greg F.
The Norcross Group
Forensics for the 21st Century

Thanks

That did the trick

On 5/5/06, Alex W. [email protected] wrote:

When I’m on the page I care about the controller variable is
Greg F.


Greg F.
The Norcross Group
Forensics for the 21st Century

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