How to Destroy multiple objects simultaneously in Rails 3
Solution 1:
destroy_all destroys the records matching conditions by calling destroy method for each instantiating record. So object’s callbacks are executed.
Model.destroy_all(:status => "inactive")
Model.where(:id => [1,2,3,4,5]).destroy_all
Model.where(:id => 1..5).destroy_all
UPDATE
User.where(:id => params[:ids]).destroy_all
/users?ids[]=1&ids[]=2&ids[]=3
Solution 2:
Model.delete([1,2,5,6])
or
Model.delete_all(["col_name in (?)", [1,2,5,6]])
Just pass the ids array