class State < Base::State
  associations_for legacy: true do |a|
    a.has_many :school_states
  end

  has_many :schools, through: :school_states

  scope :ordered, -> { order(:name) }

  def races
    Race.for_state name.delete(' ', '').underscore.to_sym
  end

  def languages
    Language.for_state name.delete(' ', '').underscore.to_sym
  end
end
