diff --git a/app/controllers/user_admin_controller.rb b/app/controllers/user_admin_controller.rb --- a/app/controllers/user_admin_controller.rb +++ b/app/controllers/user_admin_controller.rb @@ -184,7 +184,7 @@ operation = params[:operation] - if operation!='add' and operation!='remove' + if not ['add','remove','assign'].include? operation flash[:notice] = 'You did not choose the operation to perform.' redirect_to :action => 'contest_management' and return end @@ -203,8 +203,10 @@ if user if operation=='add' user.contests << contest + elsif operation=='remove' + user.contests.delete(contest) else - user.contests.delete(contest) + user.contests = [contest] end note << user.login end