From 2b1b9270fdc091007667f1c087ed31be32a47ad5 Mon Sep 17 00:00:00 2001 From: jcwimer Date: Fri, 22 Jan 2016 14:12:56 +0000 Subject: [PATCH] Can edit wrestler school --- app/controllers/wrestlers_controller.rb | 4 +--- app/views/wrestlers/_form.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/controllers/wrestlers_controller.rb b/app/controllers/wrestlers_controller.rb index ae055f5..afc2f09 100644 --- a/app/controllers/wrestlers_controller.rb +++ b/app/controllers/wrestlers_controller.rb @@ -27,10 +27,8 @@ class WrestlersController < ApplicationController # GET /wrestlers/1/edit def edit - @school = @wrestler.school - @tournament = @wrestler.tournament @weight = @wrestler.weight - @weights = @tournament.weights.sort_by{|w| w.max} + @weights = @school.tournament.weights.sort_by{|w| w.max} end # POST /wrestlers diff --git a/app/views/wrestlers/_form.html.erb b/app/views/wrestlers/_form.html.erb index 2c09d96..fa083e4 100644 --- a/app/views/wrestlers/_form.html.erb +++ b/app/views/wrestlers/_form.html.erb @@ -17,12 +17,12 @@ <%= f.text_field :name %> - <% if @school %> + <% if @tournament %> <%= f.hidden_field :school_id, :value => @school.id %> <% else %>
<%= f.label 'School' %>
- <%= f.collection_select :school_id, @tournament.schools, :id, :name %> + <%= f.collection_select :school_id, @school.tournament.schools, :id, :name %>
<% end %>