I have the following wrapper method for link_to
:
def link_to_with_current(text, link, condition, *args)
current_class = condition ? 'current' : nil
link_to text, link, :class => current_class, *args
end
When called with this sample:
link_to_with_current 'My Link', '/mylink.html', true, :id => 'mylink'
The following link is generated:
<a href="/mylink" class="current">My Link</a>
Why doesn't the ID show up?