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.
|
|
|
class GtopicBank < ApplicationRecord
|
|
|
|
belongs_to :user
|
|
|
|
belongs_to :graduation_topic, optional: true
|
|
|
|
belongs_to :course_list, optional: true
|
|
|
|
|
|
|
|
has_many :attachments, as: :container, dependent: :destroy
|
|
|
|
has_many :graduation_topics, dependent: :nullify
|
|
|
|
|
|
|
|
scope :myself, ->(user_id) { where(user_id: user_id)}
|
|
|
|
|
|
|
|
|
|
|
|
# 课题名称和描述字段长度限制
|
|
|
|
validates :name, length: { maximum: 60, too_long: "选题名称不能超过60个字符" }
|
|
|
|
validates :description, length: { maximum: 5000, too_long: "选题描述不能超过5000个字符" }
|
|
|
|
end
|