Current selected menu element?

Hi,

I am using rails 2.3.4…

Any idea how to implement such thing?:

def secondary_menu_link_to(link_name, link_path)
if (link_path is the current @controller.controller_path and
@controller.action_name)
link_to “&racuo; #{link_name}”, link_path
else
link_to link_name, link_path
end
end

I don’t know how to exactly implement the “if condition”.

I am using RESTful resources, so I don’t use :controller => … and
:action => when constructing menu links, I use the REST helper methods.
sample call of this method in a view:

<%= secondary_menu_link_to(“Users”, users_path) -%>

Thanks!

M.

On Jan 6, 2:31Â pm, Michal B. [email protected] wrote:

  else
<%= secondary_menu_link_to(“Users”, users_path) -%>

Thanks!

M.

Posted viahttp://www.ruby-forum.com/.

Sounds like you want current_page?

http://www.railsapi.com is a fantastic tool for searching
documentation when you get stuck like this.