Amy
Amy

Reputation: 15

How to add span tags to this link type in Ruby?

How can I add span tags to the following link in ruby?

<%= link_to l(:label_demo), {:action => 'test', :class => 'link' %>

Upvotes: 0

Views: 131

Answers (1)

ase
ase

Reputation: 13489

You can give the link_to function a block as an argument where you can put whatever you want to sit between the <a> and </a>.

Check out this: http://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html and this http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html for more information on the link_to and tag functions.

Upvotes: 3

Related Questions