I want to add fontawesome icon
<i class="fa fa-trash-o"></i>
in place of "Destroy"
<%= link_to 'Destroy', post_path(post), method: :delete, data: { confirm: 'Are you sure?' } %>
You can try
<%= link_to(
content_tag(
:i,
nil,
class: 'fa fa-trash-o'
),
method: :delete,
data: {
confirm: 'Are you sure?'
}
)
%>
You can try with other things that aren't :i
like :div
and if you want text inside like <i>TEXT</i>
you can try with the TEXT instead of nil, hope this helps you.
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