mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-09 07:28:41 -07:00
17 lines
422 B
Ruby
17 lines
422 B
Ruby
class School < ApplicationRecord
|
|
belongs_to :district
|
|
|
|
validates :name, presence: true
|
|
|
|
scope :alphabetic, -> { order(name: :asc) }
|
|
|
|
include FriendlyId
|
|
friendly_id :name, use: [:slugged]
|
|
|
|
def self.find_by_district_code_and_school_code(district_code, school_code)
|
|
School
|
|
.joins(:district)
|
|
.where(districts: { qualtrics_code: district_code })
|
|
.find_by_qualtrics_code(school_code)
|
|
end
|
|
end
|