How to tell if you are in a controller module

I did the following:

script/generate controller admin/products

In my layout.rhtml template I want to use the admin style sheet. How can
I tell if I am in the admin directory?

controller.controller_name and controller.controller_class_name do not
help at all, they don’t have admin anywhere in them.

Thanks for your help.

Or you can just to params[‘controller’] in your layout .rhtml page and
it
should give you “admin”

Ben J. wrote:

I did the following:

script/generate controller admin/products

In my layout.rhtml template I want to use the admin style sheet. How can
I tell if I am in the admin directory?

controller.controller_name and controller.controller_class_name do not
help at all, they don’t have admin anywhere in them.

Thanks for your help.

Is there anything within the request object that will tell me I’m in the
admin module / directory?

Try controller.controller_path. It should give you ‘admin/products’.

Julio

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