最佳答案
                                        
                                                                        
                                form_for seems to ignore any 'extra' attributes like a data-foo attribute or class passed as options in its second argument.
= form_for @user, {:url => 'foo', :class => 'x', 'data-bar' => 'baz' } do |f|
# ...
The output is a <form> tag with no x class or data-bar attribute.
What’s the fix?
Or, how can I grab a FormBuilder instance without using form_for?