obdev/app/models/participant.rb

19 lines
455 B
Ruby
Raw Normal View History

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
# 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