Multiple DELETE, in a RESTful way

I have a form where a user can select multiple checkboxes and then press a “Delete Selected” button to destroy the selected records from the database.

Currently, I have add the following to config/routes.rb:

collection do
  delete 'destroy_multiple'

This feels wrong, going against RESTful principles. Any suggestions to how I can improve this?

Hi @leeky, the good news is batch requests are coming in Rails 4.2 :slight_smile:

1 Like

Thanks for the heads up, @pedromoreira!

Any chance you could point me towards any further information on it?

@leeky, not really. I know that it is one of the projects coming out one the student initiatives (either the one with Facebook or Google Summer of Code) but is not on rails master yet. Maybe @sikachu can help point to the development fork?

You could have a PostsCollection object and controller which takes a list of posts and performs a delete on them.

1 Like

For the sake of completeness, I believe this is the relevant PR to Rails: