diff options
author | DavisLWebb <davislwebb@ymail.com> | 2014-03-07 00:05:47 -0500 |
---|---|---|
committer | DavisLWebb <davislwebb@ymail.com> | 2014-03-07 00:05:47 -0500 |
commit | abfb00904d5497c320200f3586fe503820ac651c (patch) | |
tree | cfbbfae80b36fa566bade137557c701516ad90ef /app/controllers | |
parent | 0eaebadc3d943189bef136bbc2205897c106c507 (diff) | |
parent | e74879dd4769e8bed34085ee3f978fc4a31366cb (diff) |
Merge branch 'master' of http://github.com/LukeShu/leaguer
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/tournaments_controller.rb | 13 | ||||
-rw-r--r-- | app/controllers/users_controller.rb | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index 74a1f56..3583ec3 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -11,8 +11,10 @@ class TournamentsController < ApplicationController # GET /tournaments/1 # GET /tournaments/1.json def show - unless @tournament.status - redirect_to tournament_matches_page(@tournament) + case @tournament.status + when 0 + when 1..2 + redirect_to "/tournaments/" + @tournament.id.to_s + "/matches" #tournament_matches_page(@tournament) end end @@ -25,15 +27,20 @@ class TournamentsController < ApplicationController # GET /tournaments/1/edit def edit + if params['close_action'] == 'close' + @tournament.status = 1 + @tournament.save + redirect_to "/tournaments" + end end # POST /tournaments # POST /tournaments.json def create @tournament = Tournament.new(tournament_params) - respond_to do |format| if @tournament.save + @tournament.hosts.push(current_user) format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' } format.json { render action: 'show', status: :created, location: @tournament } else diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 907958b..70facca 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -28,7 +28,7 @@ class UsersController < ApplicationController # POST /users.json def create @user = User.new(user_params) - + @user.groups = 0 respond_to do |format| if @user.save sign_in @user |