删除竞赛后跳到竞赛主页 #1600

This commit is contained in:
sw 2014-11-26 17:22:15 +08:00
parent 86413df277
commit ad2cf141cb
1 changed files with 2 additions and 2 deletions

View File

@ -188,10 +188,10 @@ class ContestsController < ApplicationController
# Added by Longjun # Added by Longjun
def destroy_contest def destroy_contest
@contest = Contest.find(params[:id]) @contest = Contest.find(params[:id])
if @contest.author_id == User.current.id if @contest.author_id == User.current.id || User.current.admin?
@contest.destroy @contest.destroy
redirect_to action: 'index' redirect_to welcome_contest_url
else else
render_403 :message => :notice_not_contest_delete_authorized render_403 :message => :notice_not_contest_delete_authorized
end end