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