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.
educoder/app/models/ec_year.rb

20 lines
683 B

6 years ago
class EcYear < ApplicationRecord
belongs_to :ec_major_school
# 课堂配置
has_many :ec_courses, dependent: :destroy
has_many :ec_course_targets, through: :ec_courses
has_one :ec_training_objective, dependent: :destroy
has_many :ec_training_subitems, through: :ec_training_objective
has_many :ec_graduation_requirements, dependent: :destroy
has_many :ec_graduation_subitems, through: :ec_graduation_requirements
has_many :ec_year_students, dependent: :destroy
has_many :ec_course_users, dependent: :destroy
has_many :managers, through: :ec_course_users, source: :user
def prev_year
self.class.find_by(year: year.to_i - 1)
end
6 years ago
end