Sha256: 6538908101df7de38bcd1e7f85a5fd9256a3ec9a98c78c3bdad1c72bea6ac79f

Contents?: true

Size: 549 Bytes

Versions: 41

Compression:

Stored size: 549 Bytes

Contents

module Rao
  # Don't forget to add routes:
  #
  #     # config/routes.rb;
  #     resources :users do
  #       post :destroy_many, on: :collection
  #     end
  #
  module ResourcesController::BatchActionsConcern
    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', count: @collection.count)
    end

    private

    def after_destroy_many_location
      collection_path
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
rao-resources_controller-0.0.3.pre app/concerns/rao/resources_controller/batch_actions_concern.rb