module Baclight class Employer < BaclightRecord self.table_name = 'Employers' 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" 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 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