18

I am using the following to try and set a PUT method on the form but it is still doing a post. I have referred to the docs and it seems like im doing this right.

form_for @firm, html: {autocomplete: "off"}, url: firm_path, method: :put do |f|
...
Jason Waldrip
  • 5,038
  • 8
  • 36
  • 59

1 Answers1

36

It does this because browsers don't support PUT/DELETE very well. You can read more about this in the Rails Guides:

However, most browsers don’t support methods other than “GET” and “POST” when it comes to submitting forms.

Rails works around this issue by emulating other methods over POST with a hidden input named "_method", which is set to reflect the desired method.

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214