Amy
Amy

Reputation: 13

Add span tags to link in ruby?

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>

Upvotes: 1

Views: 199

Answers (3)

dombesz
dombesz

Reputation: 7899

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

Upvotes: 1

mckeed
mckeed

Reputation: 9818

<% link_to :action => 'test', :path => '' do %>
  <span>demo</span>
<% end %>

Upvotes: 7

nocksock
nocksock

Reputation: 5527

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

Upvotes: 3

Related Questions