From c551852dfb9a33ad43212f3f2745a651c55d02cb Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Wed, 22 Jan 2014 22:50:47 -0500 Subject: [PATCH] Fixed wrestler show and edit --- app/controllers/wrestlers_controller.rb | 6 +++++- app/views/wrestlers/_form.html.erb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/wrestlers_controller.rb b/app/controllers/wrestlers_controller.rb index 87de081..d47711d 100644 --- a/app/controllers/wrestlers_controller.rb +++ b/app/controllers/wrestlers_controller.rb @@ -5,12 +5,13 @@ class WrestlersController < ApplicationController # GET /wrestlers.json def index @wrestlers = Wrestler.all - #@school = School.find(@wrestler.school_id) + @school = School.find(@wrestler.school_id) end # GET /wrestlers/1 # GET /wrestlers/1.json def show + @school = School.find(@wrestler.school_id) end # GET /wrestlers/new @@ -34,6 +35,9 @@ class WrestlersController < ApplicationController # GET /wrestlers/1/edit def edit @school_field = @wrestler.school_id + @school = School.find(@wrestler.school_id) + @tournament = Tournament.find(@school.tournament_id) + @weight = Weight.where(tournament_id: @tournament.id) end # POST /wrestlers diff --git a/app/views/wrestlers/_form.html.erb b/app/views/wrestlers/_form.html.erb index 50c6a7f..4eb641c 100644 --- a/app/views/wrestlers/_form.html.erb +++ b/app/views/wrestlers/_form.html.erb @@ -24,10 +24,10 @@ <%= f.collection_select :school_id, School.all, :id, :name %> <% end %> -
<%= f.label 'Weight Class' %>
<%= f.collection_select :weight_id, @weight, :id, :max %> +
<%= f.label :original_seed %>