From e614a2d111c6710b562ed425f2480bb458016172 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 27 Dec 2016 12:33:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index a564916e9..d6722274c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -917,6 +917,9 @@ class User < Principal # 判断是否是竞赛的主办人 def admin_of_contest?(contest) + if contest.nil? + return false + end if ContestMember.where("user_id =? and contest_id =?", self.id, contest.id).count == 0 return false end