Sha256: f6e20151ee57336c1019adcae65d2aa355f106465926a03e3bbc80dcf76ceb74

Contents?: true

Size: 518 Bytes

Versions: 9

Compression:

Stored size: 518 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

  private

  def notify_user!
    Notification.create! organization: organization, user: user, target: self if saved_change_to_status?
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mumuki-domain-9.1.0 app/models/exam_authorization_request.rb
mumuki-domain-9.0.6 app/models/exam_authorization_request.rb
mumuki-domain-9.0.5 app/models/exam_authorization_request.rb
mumuki-domain-9.0.4 app/models/exam_authorization_request.rb
mumuki-domain-9.0.3 app/models/exam_authorization_request.rb
mumuki-domain-9.0.2 app/models/exam_authorization_request.rb
mumuki-domain-9.0.0 app/models/exam_authorization_request.rb
mumuki-domain-8.6.1 app/models/exam_authorization_request.rb
mumuki-domain-8.6.0 app/models/exam_authorization_request.rb