current selected menu element?


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) -%>



Sounds like you want current_page? is a *fantastic* tool for searching documentation when you get stuck like this.