Detecting controller in application layout


In the application layout file (application.rhtml in /views/layout/),
I’m executing some logic to not load some files unless the user is
logged in. THat’s working well, but I need to take that logic to the
next step by doing the following:

I want to detect the controller that’s being called in the application
layout file (I’m not using separate layouts, everything starts with
application.rhtml), and execute logic based on the controller that’s
detected. I was unable to find anything on the boards that helped; is
there a way to detect the controller in a view?

Thanks very much in advance for your help!


Got it! Finally got the search string right:

    <%= params[:controller] %>
    <%= params[:action] %>


Also works:

    <%= controller.controller_name %>
    <%= controller.action_name %>

–Andrew V.