Sha256: 449375ee4ec692b8b76d4aa56c625941ac85a23fae4c5c98cb60a85082a42036
Contents?: true
Size: 559 Bytes
Versions: 29
Compression:
Stored size: 559 Bytes
Contents
# frozen_string_literal: true module SlashAdmin class BatchActionsController < SlashAdmin::BaseController def delete authorize! :destroy, model model.where(id: params[:ids]).delete_all end def model ActiveRecord::Base.connection.tables.map do |klass| testing_class = klass.capitalize.singularize.camelize return testing_class.constantize if testing_class == params[:model_class].capitalize.singularize.camelize end raise Exception.new("Can't find model #{params[:model_class]}") end end end
Version data entries
29 entries across 29 versions & 1 rubygems