Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete multiple objects in Rails with a RESTful controller?

I'd like to delete multiple objects of the same type using a RESTful controller.

The most simple thing I can think of is to have the destroy action expect a comma-separated list of ids of objects to destroy.

Is there a more elegant way to do this?

like image 296
John Bachir Avatar asked Oct 13 '22 18:10

John Bachir


1 Answers

I think it would be more elegant to take an array of ids:

http://guides.rubyonrails.org/action_controller_overview.html#hash-and-array-parameters

like image 174
cam Avatar answered Oct 19 '22 22:10

cam