Skip to content

Instantly share code, notes, and snippets.

@mikebaldry
Created October 3, 2012 15:01
Show Gist options
  • Select an option

  • Save mikebaldry/3827404 to your computer and use it in GitHub Desktop.

Select an option

Save mikebaldry/3827404 to your computer and use it in GitHub Desktop.
def active_if(controller, action = nil)
active = params[:controller] == controller.to_s &&
(action.nil? || params[:action] == action.to_s)
active ? "active" : nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment