1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-18 13:37:55 +00:00

Fixing controllers and views with validations

This commit is contained in:
2015-12-30 19:42:58 +00:00
parent 198c6d5e82
commit 9fb1615120
8 changed files with 29 additions and 35 deletions

View File

@@ -14,7 +14,6 @@ class WrestlersController < ApplicationController
def new
@wrestler = Wrestler.new
if params[:school]
@school_field = params[:school]
@school = School.find(params[:school])
end
if @school
@@ -28,7 +27,6 @@ class WrestlersController < ApplicationController
# GET /wrestlers/1/edit
def edit
@school_field = @wrestler.school_id
@school = @wrestler.school
@tournament = @wrestler.tournament
@weight = @wrestler.weight
@@ -40,6 +38,7 @@ class WrestlersController < ApplicationController
def create
@wrestler = Wrestler.new(wrestler_params)
@school = School.find(wrestler_params[:school_id])
@weights = @school.tournament.weights
respond_to do |format|
if @wrestler.save
format.html { redirect_to @school, notice: 'Wrestler was successfully created.' }