mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
22 lines
372 B
Ruby
22 lines
372 B
Ruby
# frozen_string_literal: true
|
|
|
|
class District < ApplicationRecord
|
|
has_many :schools
|
|
encrypts :password
|
|
|
|
validates :name, presence: true
|
|
|
|
scope :alphabetic, -> { order(name: :asc) }
|
|
|
|
include FriendlyId
|
|
|
|
friendly_id :name, use: [:slugged]
|
|
|
|
before_save do
|
|
self.slug ||= name.parameterize
|
|
end
|
|
|
|
def short_name
|
|
name.split(" ").first.downcase
|
|
end
|
|
end
|