From d7c82a8d710d7b9eadff753683d4b6deef41d096 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Wed, 18 Jan 2017 13:53:17 +0000 Subject: [PATCH] Fixed bug on wrestler form to allow a tournament director to move a wrestler to another school --- app/controllers/wrestlers_controller.rb | 1 + app/views/wrestlers/_form.html.erb | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/wrestlers_controller.rb b/app/controllers/wrestlers_controller.rb index 2a6caa8..e83a7c6 100644 --- a/app/controllers/wrestlers_controller.rb +++ b/app/controllers/wrestlers_controller.rb @@ -31,6 +31,7 @@ class WrestlersController < ApplicationController def edit @weight = @wrestler.weight @weights = @school.tournament.weights.sort_by{|w| w.max} + @school = @wrestler.school end # POST /wrestlers diff --git a/app/views/wrestlers/_form.html.erb b/app/views/wrestlers/_form.html.erb index b827403..bb1a141 100644 --- a/app/views/wrestlers/_form.html.erb +++ b/app/views/wrestlers/_form.html.erb @@ -17,14 +17,12 @@ <%= f.text_field :name %> <% if can? :manage, @wrestler.tournament %> - <% if @tournament %> - <%= f.hidden_field :school_id, :value => @school.id %> - <% else %>
<%= f.label 'School' %>
<%= f.collection_select :school_id, @school.tournament.schools, :id, :name %>
- <% end %> + <% else %> + <%= f.hidden_field :school_id, :value => @school.id %> <% end %>
<%= f.label 'Weight Class' %>