Hi!
I have a link to the users profile in my meta navigation and I am
looking for an easy, automatic way to tell the user, that the is
currently on the page that the link describes.
This is good but not good enough, since I cannot assign an "active"
class in case the page is the current page.
= link_to_unless_current "your profile", user_url(current_user)
According to the documentation (
http://github.com/rails/rails/blob/
9e29c084eb0551eb18b666c8df53b9985af8aa16/actionpack/lib/action_view/
helpers/url_helper.rb#L354) there is a solution for that:
= link_to_unless_current "Dein Profil", user_url(current_user) do |
name|
%strong.current= name
This works fine with one problem: It generates an unwanted "0" after
the tag.
Output if url is current:
<strong class="current"> Dein Profil </strong>
0
Where does this "0" come from and how do I get rid of it?
Thanks a lot!
Tobias