obdev/app/models/vendor.rb

13 lines
405 B
Ruby

class Vendor < ApplicationRecord
# Many-to-many relationships
has_and_belongs_to_many :employers
has_many :service_contracts
has_many :participants, through: :service_contracts
has_many :bank_accounts, as: :owner
has_many :onboarding_items, as: :owner
accepts_nested_attributes_for :onboarding_items
# Validations
validates :tin, uniqueness: true, allow_blank: true, presence: true
end