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.
19 lines
676 B
19 lines
676 B
6 years ago
|
class EcGraduationSubitem < ApplicationRecord
|
||
|
|
||
|
default_scope { order(position: :asc) }
|
||
|
|
||
|
belongs_to :ec_graduation_requirement
|
||
|
|
||
|
has_many :ec_require_sub_vs_standards, dependent: :destroy
|
||
|
has_many :ec_course_supports, dependent: :destroy
|
||
|
has_many :ec_courses, through: :ec_course_supports
|
||
|
|
||
|
has_many :ec_graduation_subitem_course_targets, dependent: :delete_all
|
||
|
has_many :ec_course_targets, through: :ec_graduation_subitem_course_targets
|
||
|
|
||
|
validates :position, presence: true, numericality: { only_integer: true, greater_than: 0 }
|
||
|
validates :content, presence: true
|
||
|
|
||
|
accepts_nested_attributes_for :ec_course_supports, allow_destroy: true
|
||
|
end
|