Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a link to a label/hint in formtastic with haml

I'm trying to add a link to a checkbox in formtastic, using haml. It looks like formtastic removes all ruby/haml/html syntax from the text for the label or hint when it parses it.

That is, this doesn't work:

= f.input :terms, label: '=link_to \'Here\', path_to_link', hint: '=link_to \'Other Place\', path_to_other_link', as: :boolean

Is there anything that will other than writing another div outside of this input? Or am I going about this all wrong? I'm a rails/haml/formtastic noob.

like image 801
tessr Avatar asked Oct 21 '11 19:10

tessr


1 Answers

if you use ' for string quotation, you're basically telling ruby not to parse that content.

try something like this instead:

= f.input :terms, label: link_to('Here', path_to_link), hint: link_to('Other place', path_to_other_link), as: :boolean
like image 189
Frost Avatar answered Sep 22 '22 13:09

Frost