views:

62

answers:

3

How can I add span tags to the following link?

<%= link_to 'demo', :action => 'test', :path => '' %>

Should display like this:

<a href="/test"><span>demo</span></a>
+3  A: 
<%= link_to '<span>demo</span>', :action => 'test', :path => '' %>
Nils Riedemann
Oh I see. What about if its something like this? <% link_to h(filename), :action => 'test' %>
Amy
<%= link_to "<span>#{h(filename)}</span>", :action => 'test', :path => '' %>
Nils Riedemann
Cool, thanks for your help :)
Amy
+7  A: 
<% link_to :action => 'test', :path => '' do %>
  <span>demo</span>
<% end %>
mckeed
The Rails API backs you up with their block example at http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#M001597
Sarah Vessels
+1  A: 

or you can use link_to content_tag(:span, "demo"),:action => 'test', :path => ''

dombesz