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.
20 lines
898 B
20 lines
898 B
6 years ago
|
# TODO:: change table column :weigths => :weight
|
||
|
class EcCourseTarget < ApplicationRecord
|
||
|
belongs_to :ec_course
|
||
|
|
||
|
has_many :ec_graduation_subitem_course_targets, dependent: :destroy
|
||
|
has_many :ec_graduation_subitems, through: :ec_graduation_subitem_course_targets
|
||
|
has_many :ec_student_score_targets
|
||
|
has_many :ec_course_achievement_methods, dependent: :destroy
|
||
|
has_many :ec_achievement_evaluation_relates, dependent: :destroy
|
||
|
|
||
|
validates :content, presence: true
|
||
|
validates :standard_grade, numericality: { only_integer: true, greater_than: 0 }
|
||
|
validates :weight, presence: true, numericality: { less_than_or_equal_to: 1, greater_than_or_equal_to: 0 }
|
||
|
|
||
|
accepts_nested_attributes_for :ec_graduation_subitem_course_targets, allow_destroy: true
|
||
|
accepts_nested_attributes_for :ec_course_achievement_methods, allow_destroy: true
|
||
|
|
||
|
number_display_methods :weight
|
||
|
end
|