Using link_to with embedded HTML
Two ways. Either:
<%= link_to user_path(@user) do %> <i class="icon-ok icon-white"></i> Do it@<% end %>
Or:
<%= link_to '<i class="icon-ok icon-white"></i> Do it@'.html_safe, user_path(@user) %>
I had the same need recently. Try this:
<%= link_to '<i class="icon-ok icon-white"></i> Do it'.html_safe, user_path(@user) %>
You have also the possibility to create an helper method like below:
def link_fa_to(icon_name, text, link) link_to content_tag(:i, text, :class => "fa fa-#{icon_name}"), linkend
Adapt the classes to your needs.