I’m trying to apply a class to the form generated by button_to in Rails 3.
The :class option sets the class for the submit button so the docs tell us to use :form_class to apply a class to the form.
E.g.
<%= button_to 'x', user_contact_path(@user, contact), :method => :delete, :form_class => "delete" %>
This just adds the attribute form_class="delete" to the button element. I’ve tried various combinations using :html_options and so on.
Anybody know how to do this?
That method works perfectly fine for me. I am able to do:
the above generates the following:
However, this is in Rails 3.1 as the link in your question points and the same wouldn’t work in Rails 3.0.x since the form class is hard coded.
From url_helper code: