Files
Eric Bell 392781f7aa chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
2026-08-11 14:44:09 -04:00

26 lines
515 B
Ruby

# frozen_string_literal: true
class SchoolYear < ApplicationRecord
belongs_to :school
belongs_to :year
has_many :classrooms, dependent: :restrict_with_error
has_many :quarters, dependent: :destroy
delegate :name, to: :school, prefix: :school
delegate :name, to: :year, prefix: :year
after_create :create_quarters
def name
"#{school_name} (#{year_name})"
end
private
def create_quarters
(1..4).each do |n|
quarters.create!(name: "Quarter #{n}", number: n)
end
end
end