2024-01-16 20:54:44 -06:00
|
|
|
class Vendor < ApplicationRecord
|
|
|
|
# Many-to-many relationships
|
|
|
|
has_and_belongs_to_many :employers
|
2024-01-31 02:19:24 -06:00
|
|
|
has_many :service_contracts
|
|
|
|
has_many :participants, through: :service_contracts
|
2024-02-12 17:26:45 -06:00
|
|
|
has_many :bank_accounts, as: :owner
|
2024-02-17 02:42:12 -06:00
|
|
|
has_many :onboarding_items, as: :owner
|
|
|
|
accepts_nested_attributes_for :onboarding_items
|
2024-02-06 17:36:08 -06:00
|
|
|
|
|
|
|
# Validations
|
|
|
|
validates :tin, uniqueness: true, allow_blank: true, presence: true
|
2024-01-16 20:54:44 -06:00
|
|
|
end
|