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



Question:

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

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


Solution:1

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »