0
现在,我有以下和它的作品:如何使用PUT方法在Rails链接中添加表单参数?
<%= link_to 'stop service', service_path(:id => @service.id, 'service[stopped]' => true, method: :put, data: { confirm: 'Are you sure?' } %>
链接看起来是这样的:http://localhost:3000/services/1?service%5Bstopped%5D=true
所以service[stopped]
参数被提交到服务器的查询字符串的一部分。我需要它作为POST/PUT表单参数提交,而不是。我尝试在data
散列内添加'service[stopped]' => true
,但那没有做任何事情。