Sha256: d5ad85384011ca1aeabe44e3be311ea0d978b16f50fae285fd0c01d1fbac9491

Contents?: true

Size: 760 Bytes

Versions: 5

Compression:

Stored size: 760 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])
      count = @collection.count
      @collection.destroy_all

      default_message = t('.success', inflections.merge(count: count))
      respond_with @collection,
        location: after_destroy_many_location,
        notice: t('rao.resources_controller.batch_actions_concern.destroy_many.success', inflections.merge(count: count, default: default_message))
    end

    private

    def after_destroy_many_location
      collection_path
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rao-resources_controller-0.0.48.pre app/concerns/rao/resources_controller/batch_actions_concern.rb
rao-resources_controller-0.0.47.pre app/concerns/rao/resources_controller/batch_actions_concern.rb
rao-resources_controller-0.0.46.pre app/concerns/rao/resources_controller/batch_actions_concern.rb
rao-resources_controller-0.0.45.pre app/concerns/rao/resources_controller/batch_actions_concern.rb
rao-resources_controller-0.0.44.pre app/concerns/rao/resources_controller/batch_actions_concern.rb