Skip to content

Instantly share code, notes, and snippets.

@evanwalsh
Created May 3, 2009 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanwalsh/106101 to your computer and use it in GitHub Desktop.
Save evanwalsh/106101 to your computer and use it in GitHub Desktop.
# This helper method will either generate a regular link => <a href="/whatever">Whatever</a>
# or it will generate a link with a "current class => <a href="/whatever" class="current">Whatever</a>
# Easy, huh?
def link_to_or_current(name, options = {}, html_options = {})
link_to_unless_current(name, options, html_options) do
link_to(name, options, { :class => :current })
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment