diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 49a344aaa..cb31067cb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -224,7 +224,7 @@ class ApplicationController < ActionController::Base # 未授权的捕捉407,弹试用申请弹框 def require_login #6.13 -hs - tip_exception(401, "..") unless User.current.logged? + tip_exception(401, "请登录后再操作") unless User.current.logged? end # 异常提醒 diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 29a5455ca..5f18a15a9 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -181,7 +181,7 @@ class ChallengesController < ApplicationController begin ActiveRecord::Base.transaction do tab = params[:tab].to_i - @challenge.update_attributes(challenge_params) + @challenge.update_attributes!(challenge_params) if tab == 0 && @challenge.st == 0 @challenge.challenge_tags.delete_all if params[:challenge_tag].present? @@ -211,7 +211,7 @@ class ChallengesController < ApplicationController # last: 末尾匹配, full: 全完匹配 logger.info("set: #{set}; match_rule : #{set[:match_rule]}") match_rule = set[:match_rule] == 'last' ? 'last' : 'full' - TestSet.create(:challenge_id => @challenge.id, + TestSet.create!(:challenge_id => @challenge.id, :input => "#{set[:input]}", :output => "#{set[:output]}", :is_public => params_hidden[index], diff --git a/app/models/test_set.rb b/app/models/test_set.rb index 01bc2b767..c0674cdf0 100644 --- a/app/models/test_set.rb +++ b/app/models/test_set.rb @@ -2,6 +2,6 @@ class TestSet < ApplicationRecord # match_rule: 匹配规则: full: 完全匹配, last: 末尾匹配 # validates :input, length: { maximum: 5000, too_long: "不能超过5000个字符" } - validates :output, length: { maximum: 5000, too_long: "不能超过5000个字符" } + validates :output, length: { maximum: 65000, too_long: "不能超过65000个字符" } end