I have some static pages in a navigation menu. I want to add a class like \"current\" to the item which is currently displaying.
The way I am doing so is to add tons
According to the answer by Skilldrick, I'll change it to the following:
def nav_link(*args, &block) is_active = current_page?(args[0]) || current_page?(args[1]) class_name = is_active ? 'active' : nil content_tag(:li, class: class_name) do link_to *args, &block end end
to make it much more useful.