Created
April 21, 2011 06:09
-
-
Save twe4ked/933826 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
def active_link?(controller, action = nil) | |
action_match = case | |
when action.nil? | |
true | |
when action.respond_to?(:include?) | |
action.include? params[:action] | |
else | |
action == params[:action] | |
end | |
params[:controller] == controller && action_match ? 'active ' : '' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment