Module: ResourcesController::BatchActionsConcern

Defined in:
app/concerns/resources_controller/batch_actions_concern.rb

Overview

Don't forget to add routes:

# config/routes.rb;
resources :users do
  post :destroy_many, on: :collection
end

Instance Method Summary collapse

Instance Method Details

#destroy_manyObject


10
11
12
13
14
15
# File 'app/concerns/resources_controller/batch_actions_concern.rb', line 10

def destroy_many
  @collection = load_collection_scope.where(id: params[:ids])
  @collection.destroy_all

  respond_with @collection, location: after_destroy_many_location, notice: t('.success')
end