From effe4608e808a385bb912fccac26381d0bd0c95a Mon Sep 17 00:00:00 2001 From: tkimia Date: Thu, 3 Apr 2014 18:03:25 -0400 Subject: matches table is back, and a lot of things are fixed --- app/controllers/tournaments_controller.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index 4bba997..ae384c1 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -76,7 +76,7 @@ class TournamentsController < ApplicationController when "join" respond_to do |format| if @tournament.join(current_user) - format.html { render action: 'show', notice: 'You have joined this tournament.' } + format.html { redirect_to @tournament, notice: 'You have joined this tournament.' } format.json { head :no_content } end format.html { render action: 'permission_denied', status: :forbidden } @@ -85,7 +85,7 @@ class TournamentsController < ApplicationController when "leave" respond_to do |format| if @tournament.leave(current_user) - format.html {redirect_to tournaments_url, notice: 'You have left the tournament.' } + format.html { redirect_to tournaments_url, notice: 'You have left the tournament.' } format.json { head :no_content } end format.html {redirect_to @tournament, notice: 'You were\'t a part of this tournament.' } @@ -94,10 +94,9 @@ class TournamentsController < ApplicationController when "start" @tournament.status = 1 @tournament.save - @tournament.setup() respond_to do |format| if @tournament.setup - format.html { render action: 'show', notice: 'You have joined this tournament.' } + format.html { redirect_to @tournament, notice: 'You have joined this tournament.' } format.json { head :no_content } end format.html { render action: 'permission_denied', status: :forbidden } @@ -105,7 +104,7 @@ class TournamentsController < ApplicationController end else respond_to do |format| - format.html { render action: 'show', notice: "Invalid action", status: :unprocessable_entity } + format.html { redirect_to @tournament, notice: "Invalid action", status: :unprocessable_entity } format.json { render json: @tournament.errors, status: :unprocessable_entity } end end -- cgit v1.2.3-2-g168b