Drop nav_link_helper.rb into app/helpers in your Rails app and enjoy.
The nav_link helper works just like the standard Rails link_to helper, but adds a 'selected' class to your link (or its wrapper) if certain criteria are met. By default, if the link's destination url is the same url as the url of the current page, a default class of 'selected' is added to the link.
###Basic Example If the url of the current page matches the url of the link (http://example.com/page),
<%= nav_link 'My_Page', 'http://example.com/page' %>