The following code:
<%= link_to content_tag(:span, 'foo'), :action => 'new' %&g开发者_JS百科t;
Renders the link like this:
<a href="/new"><span>foo</span></a>
I would like to add the bold tags after the ending span tag like this:
<a href="/new"><span>foo</span><b></b></a>
How can I add the tags after the ending span tag?
You can pass link_to
a block instead of a string param:
<%= link_to :action => 'new' do %>
<span>foo</span>
<strong></strong>
<% end %>
Note: If you're on Rails 2.3 or earlier, use:
<% link_to :action => 'new' do %>
精彩评论