How to add options ot the form with a FormBuilder

Hi, I’ve been using a custom form builder for all my forms and I override many of the methods for the form. What I seem to be missing is how could I use the FormBuilder to add a data option to all forms for which this form builder is used? Anyone has any idea?

Thanks.

@kmitov Correct me if I’m wrong, but for example text_field wraps the FormHelper text_field tag which should pass the options to the tag including HTML options, like data attributes:

Additional options on the input tag can be passed as a hash with options . These options will be tagged onto the HTML as an HTML element attribute as in the example shown.

True. But this will add the options on the text_field. I would like to add options on the form

<form data-custom-option='value'></form>

Is it safe to assume that those extra options are not passed to the HTML?

https://github.com/rails/rails/blob/75ac626c4e21129d8296d4206a1960563cc3d4aa/actionview/lib/action_view/helpers/form_tag_helper.rb#L830