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

25 lines
631 B

class EcYear < ActiveRecord::Base
default_scope :order => 'year desc'
validates_uniqueness_of :year, :scope => :ec_major_school_id
belongs_to :ec_major_school
# 学生列表
has_many :ec_year_students, :dependent => :destroy
# 毕业要求
has_many :ec_graduation_requirements, :dependent => :destroy
has_many :ec_graduation_subitems, through: :ec_graduation_requirements
# 培养目标
has_one :ec_training_objective, :dependent => :destroy
# 课堂配置
has_many :ec_courses, :dependent => :destroy
acts_as_attachable
def prev_year
ec_major_school.ec_years.find_by_year(year - 1)
end
end