Sha256: fa973f5d7705e6ff8fbabe42f233f50a4c0720cb2e11288f062a7f14e0d97108
Contents?: true
Size: 831 Bytes
Versions: 16
Compression:
Stored size: 831 Bytes
Contents
class ExamAuthorizationRequest < ApplicationRecord include TerminalNavigation belongs_to :exam belongs_to :user belongs_to :organization belongs_to :exam_registration enum status: %i(pending approved rejected) after_update :notify_user! def try_authorize! exam.authorize! user if approved? end def name exam_registration.description end def icon case status.to_sym when :pending { class: 'hourglass', type: 'info' } when :approved { class: 'check-circle', type: 'success' } when :rejected { class: 'times-circle', type: 'danger' } end end private def notify_user! Notification.create_and_notify_via_email! organization: organization, user: user, target: self, subject: 'exam_authorization_request_updated' if saved_change_to_status? end end
Version data entries
16 entries across 16 versions & 1 rubygems