rails, adding an undefined attribute to form_tag

forms, ruby-on-rails

Solution

Use `:data` option with a hash:

<%= f.text_field :some_field, :data => {:provide => "typeahead"} %>

Problem

i was wondering how do you put a "data-provide" attribute inside a rails form_tag? the html output i would like is... ``` <input type="text" data-provide="typeahead"> ``` however in a form_tag, i can't just do something like ``` <%= f.text_field :data-provide => "typehead" %> ``` how can i add an undefined attribute like that in a form tag? do i need to submit a hidden field or use another helper method? i was looking through the form_tag helper api and it doesn't seem like i can just define another attribute. it seems like there an easy solution to this, but im not quite sure. help would be appreciated. thanks

Original source