Sha256: 21d0394a87c2939f6c8ab88578949bf273ec7c832a67c606d7d98facd6b10b9f

Contents?: true

Size: 795 Bytes

Versions: 24

Compression:

Stored size: 795 Bytes

Contents

module KepplerLanguages
  module Concerns
    # Concern con la configuracion de parametros de los formulario
    module DestroyMultiple
      extend ActiveSupport::Concern

      included do
        before_action :can_multiple_destroy, only: [:destroy_multiple]
      end

      private

      def model
        model_name = "#{module_name}::#{controller_name.classify}"
        model_name.constantize
      end

      def redefine_ids(ids)
        ids.delete('[]').split(',').select do |id|
          id if model.exists? id
        end
      end

      # Check whether the user has permission to delete
      # each of the selected objects
      def can_multiple_destroy
        redefine_ids(params[:multiple_ids]).each do |id|
          authorize model
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
keppler-2.1.22 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.21 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.20 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.19 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.18 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.17 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.16 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.15 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.14 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.13 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.12 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.11 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.10 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.9 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.8 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.7 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.6 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.5 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.4 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb
keppler-2.1.3 installer/core/rockets/keppler_languages/app/controllers/keppler_languages/concerns/destroy_multiple.rb