1

basically I want the following output with link_to:

<a href="#"><i class="some-class"></i>Some text</a>

Any suggestions?

4

2 回答 2

2
<%= link_to "#" do %>
  <i class="some-class"></i>Some text
<% end %>

Block form of link_to for the win!

于 2012-11-03T03:49:12.347 回答
0

What about content_tag ?

link_to "#{content_tag(:i, "", :class => 'some-class')}Some text".html_safe, root_url
于 2012-11-03T03:52:09.317 回答