I have a view like this:
= simple_form_for @fixed_number, url: polymorphic_path([:manage, @numberable, :fixed_number]), method: :put do |f|
= f.input :number
= f.submit 'Ok', class: "btn btn-success"
= f.button :button, "Delete", class: "btn btn-danger", method: :delete
Obviously I want that Delete button to send the DELETE method. It doesn't work - it uses the PUT specified for the whole form. Can I have one form that changes method for a particular button?
I found a solution. I don't know if it's the best one. In particular it relies on UJS and CSS. I replaced the delete button with a styled link:
= link_to "Delete", f.options[:url], method: :delete, class: "btn btn-danger"