将html放在表单标签中不会起作用

时间:2014-06-08 00:09:49

标签: ruby-on-rails label form-for

我在我的标签中使用html_safe方法,以便在该标签内放置一个链接,但它无法正常工作

:此

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

打印

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

有什么想法吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

用块来试试;我认为在你的情况下label_tag可能更好吗?

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