Sha256: 0103ce6c998add58c4aa343f2b271f080c212085dd9bfe7810f84ff504338e02

Contents?: true

Size: 519 Bytes

Versions: 1

Compression:

Stored size: 519 Bytes

Contents

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

    private

    def after_destroy_many_location
      collection_path
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-add_ons-3.0.0.pre1 app/concerns/resources_controller/batch_actions_concern.rb