1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Updated views for matches

This commit is contained in:
2015-09-11 13:19:45 -04:00
parent 06635f3d46
commit 052eb1dd95
4 changed files with 11 additions and 13 deletions

View File

@@ -27,8 +27,8 @@ class MatchesController < ApplicationController
@match = Match.find (params[:match])
end
if @match
@w1 = Wrestler.find(@match.r_id)
@w2 = Wrestler.find(@match.g_id)
@w1 = Wrestler.find(@match.w1)
@w2 = Wrestler.find(@match.w2)
end
end
@@ -92,6 +92,6 @@ class MatchesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def match_params
params.require(:match).permit(:r_id, :g_id, :g_stat, :r_stat, :winner_id, :win_type, :score, :finished)
params.require(:match).permit(:w1, :w2, :g_stat, :r_stat, :winner_id, :win_type, :score, :finished)
end
end

View File

@@ -12,12 +12,12 @@
<% end %>
<div class="field">
<%= f.label :r_id %><br>
<%= f.number_field :r_id %>
<%= f.label :w1_name %><br>
<%= f.number_field :w1_name %>
</div>
<div class="field">
<%= f.label :g_id %><br>
<%= f.number_field :g_id %>
<%= f.label :w2_name %><br>
<%= f.number_field :w2_name %>
</div>
<div class="field">
<%= f.label :g_stat %><br>

View File

@@ -19,10 +19,8 @@
<tbody>
<% @matches.each do |match| %>
<tr>
<td><%= match.r_id %></td>
<td><%= match.g_id %></td>
<td><%= match.g_stat %></td>
<td><%= match.r_stat %></td>
<td><%= match.w1_name %></td>
<td><%= match.w2_name %></td>
<td><%= match.winner_id %></td>
<td><%= match.win_type %></td>
<td><%= match.score %></td>

View File

@@ -2,12 +2,12 @@
<p>
<strong>R:</strong>
<%= @match.r_id %>
<%= @match.w1_name %>
</p>
<p>
<strong>G:</strong>
<%= @match.g_id %>
<%= @match.w2_name %>
</p>
<p>