summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-03-06 21:22:15 -0500
committerAndrewMurrell <amurrel@purdue.edu>2014-03-06 21:22:15 -0500
commit3f6f212c1d50a0ae953104524ceffe94095307cf (patch)
treeda7766c1868ebea003c5be50572d7ca12ba10d84 /app
parente4fe0192a332a324dd207b370252669c88216488 (diff)
tournament controller to matches redirect
Diffstat (limited to 'app')
-rw-r--r--app/controllers/tournaments_controller.rb4
-rw-r--r--app/views/tournaments/_selected.html.erb2
-rw-r--r--app/views/tournaments/show.html.erb2
3 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index 6fc3ad6..3f6de26 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -11,12 +11,16 @@ class TournamentsController < ApplicationController
# GET /tournaments/1
# GET /tournaments/1.json
def show
+ unless @tournament.status
+ redirect_to tournament_matches_page(@tournament)
+ end
end
# GET /tournaments/new
def new
@games = Game.all
@tournament = Tournament.new(game: Game.find_by_id(params[:game]))
+ @tournament.status = 1
end
# GET /tournaments/1/edit
diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb
index 9b1b7f8..925e127 100644
--- a/app/views/tournaments/_selected.html.erb
+++ b/app/views/tournaments/_selected.html.erb
@@ -4,7 +4,7 @@
<% @chosen = Game.find_by(params[:game]) %>
<% @tournament.attributes.each do |name, value| %>
- <% if (name == "id") or (name =~ /.*_at$/) or (name == "game_id") or (name == "status") %>
+ <% if (name == "id") or (name =~ /.*_at$/) or (name == "game_id") or (name == "statuss") %>
<% next %>
<% end %>
<p>
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index 91c1961..cd111f7 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -46,4 +46,4 @@
</p>
<%= link_to 'Edit', edit_tournament_path(@tournament) %> |
-<%= link_to 'Back', tournaments_path %>
+<%= link_to 'Back', tournaments_path %> \ No newline at end of file