From fe66b770fdc1245120a4a98ad6e46ccba280fa3a Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 26 Oct 2019 15:18:56 +0800 Subject: [PATCH] modify competition error message --- app/forms/competitions/save_team_form.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/forms/competitions/save_team_form.rb b/app/forms/competitions/save_team_form.rb index df7690ac6..1b2b6c4a8 100644 --- a/app/forms/competitions/save_team_form.rb +++ b/app/forms/competitions/save_team_form.rb @@ -16,14 +16,13 @@ class Competitions::SaveTeamForm validate :check_teachers_enrollable def check_teachers_enrollable if competition.teacher_enroll_forbidden? # 禁止老师报名 + return if creator.is_teacher? # 因为创建者有单独校验,所以这里跳过 return if teacher_ids.blank? if teacher_ids.present? errors.add(:teacher_ids, :enroll_forbidden) return end - - return if creator.is_teacher? # 因为创建者有单独校验,所以这里跳过 end self.teacher_ids = teacher_ids.map(&:to_i) @@ -50,14 +49,13 @@ class Competitions::SaveTeamForm validate :check_members_enrollable def check_members_enrollable if competition.member_enroll_forbidden? # 禁止学生报名 + return unless creator.is_teacher? # 因为创建者有单独校验,所以这里跳过 return if member_ids.blank? if member_ids.present? errors.add(:member_ids, :enroll_forbidden) return end - - return unless creator.is_teacher? # 因为创建者有单独校验,所以这里跳过 end self.member_ids = member_ids.map(&:to_i)