Reputation: 3090
I'm trying to include a bootstrap glyphicon in a Rails link. I thought:
<%= link_to "<i class="glyphicon glyphicon-check"></i> Sign up".html_safe, signup_path, :class => "button" %>
But apparently the way I include the glyphicon is incorrect as this on the server produces the error:
unexpected tIDENTIFIER, expecting ')' ...=( link_to "<i class="glyphicon glyphicon-check"></i>" + ....
When I remove the part the link works. How can I include the glyphicon in the link/button?
Upvotes: 1
Views: 941
Reputation: 5112
try this...for example with link
_to.my answer here
<%= link_to (‘<i class=“fa fa-thumbs-up fa-lg”> </i>’).html_safe, vote_path(@image), :method=> :delete, :remote=> true%>
Upvotes: 0
Reputation: 115511
I'd do :
<%= link_to signup_path, class: "button" do %>
<i class="glyphicon glyphicon-check"></i> Sign up
<% end %>
I feel like its clearer.
Upvotes: 2
Reputation: 3090
Solution:
<%= link_to "<i class='glyphicon glyphicon-check'></i> Sign up".html_safe, signup_path, :class => "button" %>
So to use 'glyphicon glyphicon-check' instead of "glyphicon glyphicon-check".
Upvotes: 0