使用haml添加指向formtastic中的标签/提示的链接

tes*_*ssr 5 haml ruby-on-rails formtastic

我正在尝试使用haml在formtastic中添加一个复选框的链接.看起来formtastic会在解析标签或提示时从文本中删除所有ruby/haml/html语法.

也就是说,这不起作用:

= f.input :terms, label: '=link_to \'Here\', path_to_link', hint: '=link_to \'Other Place\', path_to_other_link', as: :boolean
Run Code Online (Sandbox Code Playgroud)

除了在这个输入之外写另一个div之外还有什么东西吗?或者我这样做是错的?我是铁路/ haml/formtastic noob.

Fro*_*ost 5

如果你使用 ' 作为字符串引用,你基本上是在告诉 ruby​​ 不要解析该内容。

尝试这样的事情:

= f.input :terms, label: link_to('Here', path_to_link), hint: link_to('Other place', path_to_other_link), as: :boolean
Run Code Online (Sandbox Code Playgroud)