Files
api/app/models/baclight/employer.rb
T

36 lines
1.2 KiB
Ruby
Raw Normal View History

2026-07-23 10:41:46 -04:00
module Baclight
class Employer < BaclightRecord
self.table_name = 'Employers'
2026-09-16 12:41:44 -04:00
has_one :baclight_carrier, through: :baclight_broker
2026-07-23 10:41:46 -04:00
belongs_to :baclight_broker, class_name: "Baclight::Broker", foreign_key: "broker_id"
has_many :baclight_members, class_name: "Baclight::Member", foreign_key: "employer_id", primary_key: "id"
2026-09-16 12:41:44 -04:00
# alias_attribute :id, :id
# alias_attribute :name, :name
# alias_attribute :slug, :slug
# alias_attribute :pl_plan_key, :pl_plan_key
# alias_attribute :company_pb_entity_key, :company_pb_entity_key
# alias_attribute :plan_id, :plan_id
# alias_attribute :group_number, :group_number
# alias_attribute :effective_date, :effective_date
# alias_attribute :active, :active
# alias_attribute :initialized, :initialized
# alias_attribute :broker_id, :broker_id
# alias_attribute :created_at, :created_at
# alias_attribute :updated_at, :updated_at
def carrier_id
self.baclight_broker.carrier_id
end
2026-07-23 10:41:46 -04:00
def belongs_to_levels
self.joins(baclight_broker: :baclight_carrier).select(
'baclight_broker.id AS broker_id',
'baclight_carrier.id AS carrier_id'
)
end
end
end