Skip to content

Instantly share code, notes, and snippets.

@fizx
Created October 9, 2008 16:24
Show Gist options
  • Save fizx/15812 to your computer and use it in GitHub Desktop.
Save fizx/15812 to your computer and use it in GitHub Desktop.
# Encapsulates the pattern where you want your menus to
# reflect what page you are on.
#
module ApplicationHelper
def nav_to(name, opts = {}, html = {})
if url_for(opts.merge(:only_path => true)) == request.request_uri
tag("a", {:class => "current"}.merge(html), open = true) + name + "</a>"
else
link_to(name, opts, html)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment