How can I put a tag <span>inside a tag f.label?
<span>
f.label
<%= f.label :test %>
The requested output:
<label for="test">test<span>*</span></label>
Thank you and welcome.
You need to indicate the rails that the line you give it does not need to be disinfected. Use String#html_safe.
String#html_safe
<%= f.label :test, "test<span>*</span>".html_safe %>
The label accepts the block, so you can do this:
<%= f.label :test do %> <span>*</span> <%end%>
This should do it:
<%= f.label :test, 'test<span>*</span>'.html_safe %>