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.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
class HomeworkBank < ApplicationRecord
# homework_type: 1: 普通作业 2: 编程作业( 弃用) 3: 分组作业 4: 实训作业
belongs_to :course_list
belongs_to :homework_common , optional : true
belongs_to :user
has_many :attachments , as : :container , :dependent = > :destroy
has_many :homework_commons , dependent : :nullify
scope :is_public , - > { where ( is_public : true ) }
scope :myself , - > ( user_id ) { where ( user_id : user_id ) }
validates :name , length : { maximum : 60 , too_long : " 不能超过60个字符 " }
validates :description , length : { maximum : 15000 , too_long : " 不能超过15000个字符 " }
validates :reference_answer , length : { maximum : 25000 , too_long : " 不能超过25000个字符 " }
end