diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-03-06 21:29:24 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-03-06 21:29:24 -0500 |
commit | c9f2abad7b9c967e23ed2b2867d426eb27f61387 (patch) | |
tree | 234099af3374285f89573f774795639a9bcb88d9 /app | |
parent | d72452a5965c0df32a13053ae86bcd529fc0fc9e (diff) |
make the join tables not have models
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/tournaments_controller.rb | 2 | ||||
-rw-r--r-- | app/models/team_match_pair.rb | 4 | ||||
-rw-r--r-- | app/models/tournament_user_pair.rb | 4 | ||||
-rw-r--r-- | app/models/user_team_pair.rb | 4 | ||||
-rw-r--r-- | app/models/user_tournament_pair.rb | 4 | ||||
-rw-r--r-- | app/views/tournaments/_form.html.erb | 8 | ||||
-rw-r--r-- | app/views/tournaments/index.html.erb | 4 | ||||
-rw-r--r-- | app/views/tournaments/index.json.jbuilder | 2 | ||||
-rw-r--r-- | app/views/tournaments/show.html.erb | 10 | ||||
-rw-r--r-- | app/views/tournaments/show.json.jbuilder | 2 |
10 files changed, 14 insertions, 30 deletions
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index 346e16b..571203c 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -69,6 +69,6 @@ class TournamentsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def tournament_params - params.require(:tournament).permit(:game_id, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :status) + params.require(:tournament).permit(:game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams) end end diff --git a/app/models/team_match_pair.rb b/app/models/team_match_pair.rb deleted file mode 100644 index 85f8eaa..0000000 --- a/app/models/team_match_pair.rb +++ /dev/null @@ -1,4 +0,0 @@ -class TeamMatchPair < ActiveRecord::Base - belongs_to :team - belongs_to :match -end diff --git a/app/models/tournament_user_pair.rb b/app/models/tournament_user_pair.rb deleted file mode 100644 index eb4e9c5..0000000 --- a/app/models/tournament_user_pair.rb +++ /dev/null @@ -1,4 +0,0 @@ -class TournamentUserPair < ActiveRecord::Base - belongs_to :tournament - belongs_to :user -end diff --git a/app/models/user_team_pair.rb b/app/models/user_team_pair.rb deleted file mode 100644 index c55dc2e..0000000 --- a/app/models/user_team_pair.rb +++ /dev/null @@ -1,4 +0,0 @@ -class UserTeamPair < ActiveRecord::Base - belongs_to :user - belongs_to :team -end diff --git a/app/models/user_tournament_pair.rb b/app/models/user_tournament_pair.rb deleted file mode 100644 index b2676e5..0000000 --- a/app/models/user_tournament_pair.rb +++ /dev/null @@ -1,4 +0,0 @@ -class UserTournamentPair < ActiveRecord::Base - belongs_to :user - belongs_to :tournament -end diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb index c2c0ba7..d098cbb 100644 --- a/app/views/tournaments/_form.html.erb +++ b/app/views/tournaments/_form.html.erb @@ -16,6 +16,10 @@ <%= f.text_field :game_id %> </div> <div class="field"> + <%= f.label :status %><br> + <%= f.number_field :status %> + </div> + <div class="field"> <%= f.label :min_players_per_team %><br> <%= f.number_field :min_players_per_team %> </div> @@ -39,10 +43,6 @@ <%= f.label :randomized_teams %><br> <%= f.check_box :randomized_teams %> </div> - <div class="field"> - <%= f.label :status %><br> - <%= f.number_field :status %> - </div> <div class="actions"> <%= f.submit %> </div> diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb index dec16d1..fb8b381 100644 --- a/app/views/tournaments/index.html.erb +++ b/app/views/tournaments/index.html.erb @@ -4,13 +4,13 @@ <thead> <tr> <th>Game</th> + <th>Status</th> <th>Min players per team</th> <th>Max players per team</th> <th>Min teams per match</th> <th>Max teams per match</th> <th>Set rounds</th> <th>Randomized teams</th> - <th>Status</th> <th></th> <th></th> <th></th> @@ -21,13 +21,13 @@ <% @tournaments.each do |tournament| %> <tr> <td><%= tournament.game %></td> + <td><%= tournament.status %></td> <td><%= tournament.min_players_per_team %></td> <td><%= tournament.max_players_per_team %></td> <td><%= tournament.min_teams_per_match %></td> <td><%= tournament.max_teams_per_match %></td> <td><%= tournament.set_rounds %></td> <td><%= tournament.randomized_teams %></td> - <td><%= tournament.status %></td> <td><%= link_to 'Show', tournament %></td> <td><%= link_to 'Edit', edit_tournament_path(tournament) %></td> <td><%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' } %></td> diff --git a/app/views/tournaments/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder index df8eee4..e95c6a7 100644 --- a/app/views/tournaments/index.json.jbuilder +++ b/app/views/tournaments/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@tournaments) do |tournament| - json.extract! tournament, :id, :game_id, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :status + json.extract! tournament, :id, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams json.url tournament_url(tournament, format: :json) end diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index 355bc90..208c6f4 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -6,6 +6,11 @@ </p> <p> + <strong>Status:</strong> + <%= @tournament.status %> +</p> + +<p> <strong>Min players per team:</strong> <%= @tournament.min_players_per_team %> </p> @@ -35,10 +40,5 @@ <%= @tournament.randomized_teams %> </p> -<p> - <strong>Status:</strong> - <%= @tournament.status %> -</p> - <%= link_to 'Edit', edit_tournament_path(@tournament) %> | <%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/show.json.jbuilder b/app/views/tournaments/show.json.jbuilder index 7bedd4b..de2fbe0 100644 --- a/app/views/tournaments/show.json.jbuilder +++ b/app/views/tournaments/show.json.jbuilder @@ -1 +1 @@ -json.extract! @tournament, :id, :game_id, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :status, :created_at, :updated_at +json.extract! @tournament, :id, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :created_at, :updated_at |