Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails link_to with font-awesome and external url

I'm trying to link to a youtube page in a rails app with the font-awesome gem.

<i><%= link_to fa_icon "youtube-square 2x", @book.youtube %></i>

In doing so, I receive no implicit conversion of Symbol into String error message.

Do I need to remove the font-awesome helper and include it as a class, or is there another way to make this work together?

like image 713
jgrant Avatar asked Feb 17 '16 22:02

jgrant


1 Answers

Looking at the docs, I believe that you need to put the fa_icon helper in a link_to block:

<%= link_to @book.youtube do %>
    <%= fa_icon "youtube-square 2x" %>
<% end %>
like image 93
Vucko Avatar answered Nov 20 '22 15:11

Vucko