simple_form delete method instead post method

ruby-on-rails, simple-form

Solution

Unfortunately simply stating that it doesn't work is not helpful in understanding the problem you're seeing, but I'll make a guess based on my own initial confusion with the "method:" parameter. Most browsers don't support PUT and DELETE methods, so what simple_form_for does is generate a form with a POST method, but it also adds a hidden field to pass the actual method. So:

simple_form_for @service, url: service_path, method: :delete

generates:

<form action="/services/6" method="post">
  <input name="_method" type="hidden" value="delete" />
....

Rails uses that to call the correct controller method. Hope that helps.

Problem

In simple_form is possible to use the http delete verb instead the default post verb? ``` <%= simple_form_for @object , method: :delete do |f| %> <%= f.input :instance_name, as: :check_boxes, collection: @roles %> <%= f.button :submit %> <% end %> ``` It doesn't works.

Original source