Icon_search

Items tagged with "link to unless current"

Show:  All  |  News Items  |  Blog Posts

Blog Posts

Piggybacking on link_to_unless

Aug 26, 2008 by Colin

We needed to add CSS to HTML links based on certain conditions (for instance, if you're already there). That's pretty easy to do by using link_to_unless, but the easy way isn't very DRY (Don't Repeat Yourself): <%= link_to_unless(@current_controller=='faq', "Frequently Asked Questions", faq_path){ link_to("Frequently Asked Questions", faq_path, :class =...

Tagged: rails, helpers, helper method, active, css, link to unless current