Search code examples
ruby-on-railsformtastic

How to get the input value on Formtastic's hint?


I have a Formtastic form and would like it to display a link in the hint if there's one.

f.input :link, hint: 'link here'

Solution

  • The solution I found to solve this was to use f.objectand then call the attribute link on it, like so:

      form do |f|
        f.inputs do
          f.input :link, hint: link_to(f.object.link, f.object.link)
        end
        f.actions do
          f.action :submit
        end
      end