mirror of
https://github.com/edcommonwealth/Dashboard.git
synced 2026-03-16 09:45:53 -07:00
chore: update schools and districts to correct association between them
This commit is contained in:
parent
3093d9236a
commit
0f525cf2e8
10 changed files with 12 additions and 28 deletions
|
|
@ -1,11 +1,10 @@
|
|||
module Dashboard
|
||||
class School < ApplicationRecord
|
||||
self.table_name = "schools"
|
||||
belongs_to :district, class_name: "District", primary_key: :id
|
||||
belongs_to :district, class_name: "District", foreign_key: :dashboard_district_id
|
||||
|
||||
has_many :dashboard_survey_item_responses, dependent: :delete_all
|
||||
# has_many :dashboard_survey_item_responses, dependent: :delete_all
|
||||
|
||||
# validates :name, presence: true
|
||||
validates :name, presence: true
|
||||
|
||||
scope :alphabetic, -> { order(name: :asc) }
|
||||
scope :school_hash, -> { all.map { |school| [school.dese_id, school] }.to_h }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue