Forum: Ruby on Rails How to know the current Controller

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Paulo M. (Guest)
on 2007-07-30 19:59
How can I get in the ...\layouts\application.rhtml the "name" of the
current Controller?

//I need to set the var page_id:

<% @page_id = "..current_controler"%>
<ul class="tabnav">

        //to build correctly the menu
  <%= menu_builder(@page_id) %>
</ul>

Thanks
Scott C. (Guest)
on 2007-07-30 20:05
This is my first response...so take it for what it's worth ;)

<%= controller.controller_name %>

or

<% @page_id = controller.controller_name %>
Javier G. (Guest)
on 2007-07-30 20:10
(Received via mailing list)
<%= controller.controller_name %>
Paulo M. (Guest)
on 2007-07-30 20:23
Scott Caldwell wrote:
> This is my first response...so take it for what it's worth ;)
>
> <%= controller.controller_name %>
>
> or
>
> <% @page_id = controller.controller_name %>

It Works,
thank You very much for You help
Scott C. (Guest)
on 2007-07-30 20:33
No problem...glad to give a tiny bit back..


-Scott
This topic is locked and can not be replied to.