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|
...
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|
...
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.