ruby-on-railsrubyfont-awesomeprawnprawnto

Combine link_to and icon helpers in ruby


I'm using the icon helper for the "font-awesome-sass" gem. I'm also using link_to to link to a PDF that is being generated using prawn and prawnto. How can I combine these two lines to I have a font-awesome link to my pdf?

<p><%= link_to "PDF", hotel_shell_path(@hotel_shell, :format => 'pdf') %></p>

and

<a><%= icon("file-pdf-o", "", class: "", href: '#') %></a>

Thanks in advance. If you need more details, let me know.


Solution

  • I think you are looking for something like this, a link_to with do block :

    <%= link_to  hotel_shell_path(@hotel_shell, :format => 'pdf')  do %>
      <%= icon("file-pdf-o", "", class: "", href: '#') %>
    <% end %>