I made a helper called nav_link
:
def nav_link(link_text, link_path)
class_name = current_page?(link_path) ? 'current' : ''
content_tag(:li, :class => class_name) do
link_to link_text, link_path
end
end
used like:
nav_link 'Home', root_path
which will produce HTML like
<li class="current"><a href="/">Home</a></li>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…