summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-24 17:01:42 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-24 17:02:00 -0400
commit27c3e207b299e6c5a94a1ab81412bb9e11a0d92a (patch)
tree744f90df73c92499ead5619913f8957187487ef6
parent992dc06e50d74aca79ed58d868be6113e3ebe55c (diff)
rename Tournament#tournament_stages to Tournament#stages
-rw-r--r--app/controllers/tournaments_controller.rb4
-rw-r--r--app/models/tournament.rb2
-rw-r--r--app/views/matches/index.html.erb4
3 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index ebc54c1..1354ad6 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -116,8 +116,8 @@ class TournamentsController < ApplicationController
success = true
ActiveRecord::Base.transaction do
success &= @tournament.save &&
- success &= @tournament.tournament_stages.create(scheduling: "elimination")
- success &= @tournament.tournament_stages.first.create_matches
+ success &= @tournament.stages.create(scheduling: "elimination")
+ success &= @tournament.stages.first.create_matches
end
if success
format.html { redirect_to @tournament, notice: 'You have started this tournament.' }
diff --git a/app/models/tournament.rb b/app/models/tournament.rb
index caa711c..861be6c 100644
--- a/app/models/tournament.rb
+++ b/app/models/tournament.rb
@@ -1,6 +1,6 @@
class Tournament < ActiveRecord::Base
belongs_to :game
- has_many :tournament_stages
+ has_many :stages, class_name: "TournamentStage"
has_many :settings_raw, class_name: "TournamentSetting"
has_and_belongs_to_many :players, class_name: "User", association_foreign_key: "player_id", join_table: "players_tournaments"
has_and_belongs_to_many :hosts, class_name: "User", association_foreign_key: "host_id", join_table: "hosts_tournaments"
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb
index d8538df..761f12a 100644
--- a/app/views/matches/index.html.erb
+++ b/app/views/matches/index.html.erb
@@ -12,7 +12,7 @@
</tr>
</thead>
<tbody>
- <% @tournament.tournament_stages.ordered(:id)each do |stage| %>
+ <% @tournament.stages.ordered(:id)each do |stage| %>
<% stage.matches_ordered.keys.sort.reverse.each do |match_key| %><tr>
<% match = stage.matches_ordered[match_key] %>
<td><%= "Match #{match.id}" %></td>
@@ -35,6 +35,6 @@
<br>
-<% @tournament.tournament_stages.ordered(:id).each do |stage| %>
+<% @tournament.stages.ordered(:id).each do |stage| %>
<div class="graph"><%= raw stage.to_svg(current_user) %></div>
<% end %>