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/course_second_category.rb

16 lines
476 B

6 years ago
class CourseSecondCategory < ApplicationRecord
default_scope { order("course_second_categories.position ASC") }
belongs_to :course
belongs_to :course_module
has_many :homework_commons
validates :name, length: { maximum: 30 }
def category_type_str
category_type == "graduation" && name == "毕设选题" ? "graduation_topics" : (
category_type == "graduation" && name == "毕设任务" ? "graduation_tasks" : category_type
)
end
end