A new twist on 'link_to_unless_current'
I’ve been thinking it would be nice to have a smarter alternative to Rails’ link_to_unless_current view helper: rather than being relegated to plain old text, the active link should remain a link and get a CSS class of active tacked onto it, so it can be styled to stand out from its siblings. It’s more intuitive for a link to always be a link, even if it’s a link to the current page. Dig?
At first I tried to do some alias_method magic to override the link_to function, but in the end I think naming the method link is not only shorter but safer!