Reputation: 753
I've got a link_to that looks like this
<%= link_to site.name, site %>
I want to add a font icon from bootstrap into the anchor text, but when I try to use raw()
for that, I can't figure out the syntax for including the site.name
hook.
This is what I'm trying:
<%= link_to raw("<i class="icon-hdd"></i> site.name"), site %>
That's not working. How do I change that line to make it work?
Upvotes: 0
Views: 1427
Reputation: 17480
Have you tried the do syntax?
<%= link_to site do %>
<i class="icon-hdd"> </i> <%= site.name%>
<% end %>
Upvotes: 3
Reputation: 25029
You need to interpolate site_name
into the string.
<%= link_to raw("<i class='icon-hdd'></i> #{site.name}"), site %>
Upvotes: 1