Sha256: d12b6390ad31ac1a8b2863f816eaf8496e5f269a215a89237b13f37800ce3910
Contents?: true
Size: 765 Bytes
Versions: 5
Compression:
Stored size: 765 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: 'info-circle', type: 'info' } when :approved { class: 'check-circle', type: 'success' } when :rejected { class: 'times-circle', type: 'danger' } end end private def notify_user! Notification.create! organization: organization, user: user, target: self if saved_change_to_status? end end
Version data entries
5 entries across 5 versions & 1 rubygems