I have a snippet that looks like this:
<%= link "<i class='fa fa-sign-out' aria-hidden='true'></i>",
to: auth_path(@conn, :delete),
method: :delete, class: "btn btn-danger" %>
It is a link. I would like to put a i element inside the text, so it shows an icon instead of text. However this escapes all the html characters and displays as text.
How do I make the i appear as html?
Put the inner html in a do
block:
<%= link to: auth_path(@conn, :delete),
method: :delete, class: "btn btn-danger" do %>
<i class='fa fa-sign-out' aria-hidden='true'></i>
<% end %>
This is documented here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With