我正在使用 Rails 4.2.3。在我的咖啡脚本中,我手动编辑表单的 URL 和操作,使其像这样......</p>
# Alter the form submit behavior
$('#new_my_object').attr("action", "/my_objects/" + id)
$('#new_my_object').attr("method", "patch")
但我提交了我的表格(通过点击我的提交按钮......)
<%= button_to "Save", { :action => "create" }, :method => :post, :class => 'button' %>
请求(在 Mac Chrome 和 Firefox 上)使用 method = “GET” 提交,而不是我将其更改为的内容。我需要做什么才能通过 PATCH 方法提交?(我需要这样做,因为这是我的更新操作所要求的)。