验证去除

video_transcode
daiao 5 years ago
parent 7a868d3fbc
commit aa933015be

@ -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
# 代码

@ -3,7 +3,7 @@ class HackSet < ApplicationRecord
validates_length_of :output, maximum: 1000, message: "不能超过1000个字符"
#validates :input, presence: { message: "测试集输入不能为空" }
validates_presence_of :output, message: "不能为空"
validates_uniqueness_of :input, scope: [:hack_id, :input], message: "多个测试集的输入不能相同"
#validates_uniqueness_of :input, scope: [:hack_id, :input], message: "多个不能相同"
# 编程题测试集
belongs_to :hack
end

Loading…
Cancel
Save