class EdFi::Id < ApplicationRecord
  belongs_to :school_year
  belongs_to :associated, polymorphic: true

  belongs_to :attendance, -> { where(ed_fi_ids: { associated_type: :Attendance }) },
    foreign_key: :associated_id, optional: true, inverse_of: :ed_fi_ids

  belongs_to :school_day, -> { where(ed_fi_ids: { associated_type: :SchoolDay }) },
    foreign_key: :associated_id, optional: true, inverse_of: :ed_fi_id
end
