Created
October 9, 2008 16:24
-
-
Save fizx/15812 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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