You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
339 B
20 lines
339 B
# frozen_string_literal: true
|
|
|
|
class District < ApplicationRecord
|
|
has_many :schools
|
|
|
|
validates :name, presence: true
|
|
|
|
scope :alphabetic, -> { order(name: :asc) }
|
|
|
|
include FriendlyId
|
|
|
|
friendly_id :name, use: [:slugged]
|
|
|
|
before_save do
|
|
self.slug ||= name.parameterize
|
|
end
|
|
|
|
scope :boston, -> { where(name: 'Boston') }
|
|
end
|