Gibson
Gibson

Reputation: 2085

Putting html inside form label wont work

I'm using html_safe method in my label in order to put a link inside that label, but It wont work

This

Acepto los <%= f.label ("#{link_to 'Terminos y condiciones', terms_path}").html_safe, class: "inline" %>

Prints this

 Acepto los <a href="/terms">terminos y condiciones</a>

Any idea?

Thanks!

Upvotes: 1

Views: 39

Answers (1)

house9
house9

Reputation: 20614

try it with a block; also I think in your case a label_tag might be better?

<%= label_tag class: "inline" do %> 
  <%= link_to 'Terminos y condiciones', terms_path %>
<% end %>

Upvotes: 1

Related Questions