semester_process_volunteer.rb 1.06 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
class SemesterProcessVolunteer < ApplicationRecord
  belongs_to :volunteer
  belongs_to :semester_process
  belongs_to :responsible, -> { with_deleted }, class_name: 'User',
    inverse_of: 'semester_processes', optional: true
  belongs_to :reviewed_by, -> { with_deleted }, class_name: 'User',
    inverse_of: 'semester_processes', optional: true
  belongs_to :commited_by, -> { with_deleted }, class_name: 'User',
    inverse_of: 'semester_processes', optional: true

Kaspar Vollenweider's avatar
Kaspar Vollenweider committed
11
  has_many :semester_process_volunteer_missions, dependent: :destroy
12
13
14
  has_many :assignments, through: :semester_process_volunteer_missions
  has_many :group_assignments, through: :semester_process_volunteer_missions

15
  has_many :semester_feedbacks, dependent: :destroy
16
  has_many :hours, dependent: :nullify
17
18
19
20

  has_many :semester_process_mails, dependent: :destroy
  has_many :mails, -> { mail }, through: :semester_process_mails
  has_many :reminders, -> { reminder }, through: :semester_process_mails
21
22
23
24
25

  # will only return an array, not a AD-result
  def missions
    assignments + group_assignments
  end
26
end