From 3de87f607e2ceaa4654d42f3b811ceba998fc61b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 26 Dec 2019 15:37:20 +0800 Subject: [PATCH] 1 --- app/models/hack_set.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/hack_set.rb b/app/models/hack_set.rb index 6afe05663..8f4ef3637 100644 --- a/app/models/hack_set.rb +++ b/app/models/hack_set.rb @@ -1,6 +1,6 @@ class HackSet < ApplicationRecord #validates :input, presence: { message: "测试集输入不能为空" } - validates :output, presence: { message: "测试集输出不能为空" } + validates :output, allow_nil: false, message: "测试集输出不能为空" validates_uniqueness_of :input, scope: [:hack_id, :input], message: "多个测试集的输入不能相同" # 编程题测试集 belongs_to :hack