Reputation: 2289
I'm trying to insert some tags inside link that was created using link_to helper
I want something like <a href = "#">Somename <sometag></sometag></a>
I tried to use
<%= link_to 'Somename', {:action => 'somepath' }, :class => 'btn' do %>
<i class="icon-file icon-white"></i>
<%end%>
but it gave me some wierd result. How can i do that?
Upvotes: 1
Views: 216
Reputation: 12235
When using a block with link_to
, the first argument should be the url/path. Whatever is inside the block will be inserted inside the <a>
tags.
<%= link_to {:action => 'somepath' }, :class => 'btn' do %>
<i class="icon-file icon-white"></i> Somename
<% end %>
Is probably closer to what you want.
Upvotes: 2