Skip to content

Instantly share code, notes, and snippets.

@romaimperator
Forked from excid3/helper.rb
Last active December 16, 2015 18:29
Show Gist options
  • Save romaimperator/5478057 to your computer and use it in GitHub Desktop.
Save romaimperator/5478057 to your computer and use it in GitHub Desktop.
def nav_link_to(title, url, options={})
li_options = {}
if matches_options?(options)
li_options[:class] = "active"
end
content_tag :li, li_options do
link_to title, url
end
end
def matches_options?(options={})
url_matches?(options[:url]) ||
path_matches?(options[:path]) ||
controller_matches?(options[:controller], options[:action])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment