diff options
-rw-r--r-- | app/controllers/tournaments_controller.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index 1e26584..386a6a4 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -65,18 +65,20 @@ class TournamentsController < ApplicationController if @tournament.join(current_user) format.html { render action: 'show', notice: 'You have joined this tournament.' } format.json { head :no_content } + else + format.html { render action: 'permission_denied', status: :forbidden } + format.json { render json: "Permission denied", status: :forbidden } end - format.html { render action: 'permission_denied', status: :forbidden } - format.json { render json: "Permission denied", status: :forbidden } end when "open" respond_to do |format| if @tournament.setup - format.html { render action: 'show', notice: 'You have joined this tournament.' } + format.html { render action: 'show', notice: 'You have opend this tournament.' } format.json { head :no_content } + else + format.html { render action: 'permission_denied', status: :forbidden } + format.json { render json: "Permission denied", status: :forbidden } end - format.html { render action: 'permission_denied', status: :forbidden } - format.json { render json: "Permission denied", status: :forbidden } end #when "close" # TODO |