From 052eb1dd959f4eb5967d3c1e4dd89b5155d072e9 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Fri, 11 Sep 2015 13:19:45 -0400 Subject: [PATCH] Updated views for matches --- app/controllers/matches_controller.rb | 6 +++--- app/views/matches/_form.html.erb | 8 ++++---- app/views/matches/index.html.erb | 6 ++---- app/views/matches/show.html.erb | 4 ++-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 7bcefe4..bc3b687 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -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 diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb index e85d0c4..55ac453 100644 --- a/app/views/matches/_form.html.erb +++ b/app/views/matches/_form.html.erb @@ -12,12 +12,12 @@ <% end %>
- <%= f.label :r_id %>
- <%= f.number_field :r_id %> + <%= f.label :w1_name %>
+ <%= f.number_field :w1_name %>
- <%= f.label :g_id %>
- <%= f.number_field :g_id %> + <%= f.label :w2_name %>
+ <%= f.number_field :w2_name %>
<%= f.label :g_stat %>
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index 8389674..661990c 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -19,10 +19,8 @@ <% @matches.each do |match| %> - <%= match.r_id %> - <%= match.g_id %> - <%= match.g_stat %> - <%= match.r_stat %> + <%= match.w1_name %> + <%= match.w2_name %> <%= match.winner_id %> <%= match.win_type %> <%= match.score %> diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 6eddc70..1d49910 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -2,12 +2,12 @@

R: - <%= @match.r_id %> + <%= @match.w1_name %>

G: - <%= @match.g_id %> + <%= @match.w2_name %>