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