|
|
|
@ -4,8 +4,8 @@ class Hack < ApplicationRecord
|
|
|
|
|
# 编程题
|
|
|
|
|
validates_length_of :name, maximum: 60, message: "不能超过60个字符"
|
|
|
|
|
validates_length_of :description, maximum: 5000, message: "不能超过5000个字符"
|
|
|
|
|
validates :description, presence: { message: "描述不能为空" }
|
|
|
|
|
validates :name, presence: { message: "名称不能为空" }
|
|
|
|
|
validates_presence_of :description, message: "描述不能为空"
|
|
|
|
|
validates_presence_of :name, message: "名称不能为空"
|
|
|
|
|
# 测试集
|
|
|
|
|
has_many :hack_sets, ->{order("position asc")}, :dependent => :destroy
|
|
|
|
|
# 代码
|
|
|
|
|