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.
23fed8aab2d6cc4524346e1e5425a02a?d=identicon&s=25 Paulo Matos (pmatos)
on 2007-07-30 17: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
F56061caeb558fbb6c1d380e8383f377?d=identicon&s=25 Scott Caldwell (scaldwell)
on 2007-07-30 18:05
This is my first response...so take it for what it's worth ;)

<%= controller.controller_name %>

or

<% @page_id = controller.controller_name %>
1053a33e3a230ede6aefadf1d1a46e9e?d=identicon&s=25 Javier Godinez (Guest)
on 2007-07-30 18:10
(Received via mailing list)
<%= controller.controller_name %>
23fed8aab2d6cc4524346e1e5425a02a?d=identicon&s=25 Paulo Matos (pmatos)
on 2007-07-30 18: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
F56061caeb558fbb6c1d380e8383f377?d=identicon&s=25 Scott Caldwell (scaldwell)
on 2007-07-30 18:33
No problem...glad to give a tiny bit back..


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