Skip to content

Instantly share code, notes, and snippets.

@ruprict
Created May 13, 2013 00:19
Show Gist options
  • Save ruprict/5565464 to your computer and use it in GitHub Desktop.
Save ruprict/5565464 to your computer and use it in GitHub Desktop.
def nav_link(link_text, link_path, force_active = false)
class_name = (force_active || current_page?(link_path)) ? 'active' : ''
content_tag(:li, :class => class_name) do
link_to link_text, link_path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment