obdev/app/models/employer.rb

17 lines
478 B
Ruby

class Employer < ApplicationRecord
# Direct association with participants
has_many :direct_participants, class_name: 'Participant'
# Association through EmployerRecord
has_many :employer_records
has_many :indirect_participants, through: :employer_records, source: :participant
# Association with Workers through direct_participants
has_many :workers, through: :direct_participants
# Other methods...
def full_name
"#{first_name} #{last_name}"
end
end