22 lines
535 B
Ruby
22 lines
535 B
Ruby
class Participant < ApplicationRecord
|
|
# Associations
|
|
belongs_to :employer, optional: true
|
|
has_many :employments
|
|
has_many :workers, through: :employments
|
|
has_many :service_contracts
|
|
has_many :vendors, through: :service_contracts
|
|
has_many :employer_records
|
|
has_many :employers, through: :employer_records
|
|
|
|
|
|
# Validations
|
|
validates :first_name, presence: true
|
|
validates :last_name, presence: true
|
|
def full_name
|
|
"#{first_name} #{last_name}"
|
|
end
|
|
|
|
# Other associations
|
|
has_and_belongs_to_many :programs
|
|
end
|