Class: ExamAuthorizationRequest

Inherits:
ApplicationRecord show all
Includes:
TerminalNavigation
Defined in:
app/models/exam_authorization_request.rb

Instance Method Summary collapse

Methods included from TerminalNavigation

#friendly, #navigable_name, #navigation_end?, #next_for, #siblings, #structural_parent

Methods inherited from ApplicationRecord

active_between, aggregate_of, all_except, defaults, #delete, #destroy!, enum_prefixed_translations_for, numbered, organic_on, resource_fields, #save, #save_and_notify!, #save_and_notify_changes!, serialize_symbolized_hash_array, teaser_on, #update_and_notify!, update_or_create!, whitelist_attributes, with_pg_retry, with_temporary_token

Methods included from WithPgLock

#with_pg_lock

Instance Method Details

#iconObject



21
22
23
24
25
26
27
28
29
30
# File 'app/models/exam_authorization_request.rb', line 21

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

#nameObject



17
18
19
# File 'app/models/exam_authorization_request.rb', line 17

def name
  exam_registration.description
end

#try_authorize!Object



13
14
15
# File 'app/models/exam_authorization_request.rb', line 13

def try_authorize!
  exam.authorize! user if approved?
end