vol1ura/Sat_9am_5km

View on GitHub
app/admin/permissions.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

ActiveAdmin.register Permission do
  belongs_to :user

  includes :event

  actions :all, except: :show

  config.filters = false

  permit_params :event_id, :action, :subject_class, :subject_id

  index download_links: false

  form do |f|
    f.semantic_errors(*f.object.errors.attribute_names)
    f.inputs do
      f.input :subject_class, as: :select, collection: Permission::CLASSES
      f.input :action, as: :select, collection: Permission::ACTIONS
      f.input :event
      f.input :subject_id
    end
    f.actions
  end
end