0

Right now, I have the following and it works:

<%= link_to 'stop service', service_path(:id => @service.id, 'service[stopped]' => true, method: :put, data: { confirm: 'Are you sure?' } %>

The link looks like this: http://localhost:3000/services/1?service%5Bstopped%5D=true

So the service[stopped] parameter gets submitted to the server as part of the query string. I need it to get submitted though as a POST/PUT form parameter instead. I tried adding 'service[stopped]' => true inside the data hash, but that didn't do anything.

at.
  • 50,922
  • 104
  • 292
  • 461

1 Answers1

1

You can try this.

<%= link_to 'stop service', service_path(:id => @service.id, 'service[stopped]' => true, data: { confirm: 'Are you sure?' }) , :method => :post %>

You can refer Rails 3 link_to generator for :post, :put, & :delete?

Community
  • 1
  • 1
Bot
  • 1,001
  • 2
  • 13
  • 32