Aaron Dufall
Aaron Dufall

Reputation: 1177

adding html to link_to

how can I add the following html into my link_to

<i class="icon-plus icon-white"></i>

<%= link_to 'add', '#', :class => 'btn btn-mini pull-right'%></th>  

so that the html that will be produced will look like this

<a class="btn btn-mini pull-right" href="#">
<i class="icon-plus icon-white"></i>
</a>

Upvotes: 0

Views: 107

Answers (2)

user650230
user650230

Reputation:

Check out the documentation for more info, but you have two main options. I prefer the second option, but it's up to you!

  1. Inline it.

    <%= link_to '<i class="icon-plus icon-white"></i>', '#', :class => 'btn btn-mini pull-right'%>
    
  2. Put it in a block.

    <%= link_to(@user) do %>
      <i class="icon-plus icon-white"></i>
    <% end %>
    

Upvotes: 0

Veraticus
Veraticus

Reputation: 16064

Check out the answer to this question, where I answer pretty much this exact same thing.

Upvotes: 1

Related Questions