chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user