Reputation: 8172
This is my link_to tag :
<%= link_to "Signout", dasharea_signout_path, method: "delete", id: "adminsignout" %>
I need to add
<i class="fa fa-tasks">
into the 'a' tag created by the above code. How can I do this?
Upvotes: 0
Views: 1529
Reputation: 7434
You can pass a block to the link_to
helper
<%= link_to dasharea_signout_path, method: "delete", id: "adminsignout" do %>
<i class="fa fa-tasks"></i>
<span>Signup</span>
<% end %>
The block content will be wrapped in the link tag.
Upvotes: 5
Reputation: 2637
You can do like below:
<%= link_to "Signout <i class='fa fa-tasks'></i>", dasharea_signout_path, method: "delete", id: "adminsignout" %>
OR in HAML
%a#adminsignout{other properties}
Signout
%i.fa.fa-tasks
Upvotes: 0