Reputation: 33775
All I want to produce is this HTML tag:
<a href="/" id="logo"></a>
I tried:
<%= link_to root_path, id: "logo" %>
But this produces:
<a href="/?id=logo">/</a>
I also tried:
<%= link_to(root_path), id: "logo" %>
But that produces:
SyntaxError at /
syntax error, unexpected ',', expecting ')'
Thoughts?
Edit 1
The reason I am doing it like this is because I am including the logo via CSS....so that's why I haven't done a link_to ... do
block.
Upvotes: 0
Views: 838
Reputation: 6485
This works for me:
<%= link_to "linky", "/", id: "logo" %>
If you don't want there to be a value you can just omit "linky" but leave the string declaration like:
<%= link_to "", "/", id: "logo" %>
This returns
<a id="logo" href="/">linky</a>
Upvotes: 2