1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

You can now create a wrestler from school page

This commit is contained in:
Jacob Cody Wimer
2014-01-13 12:36:52 -05:00
parent 898caee2a6
commit 1112699025
3 changed files with 8 additions and 2 deletions

View File

@@ -15,6 +15,9 @@ class WrestlersController < ApplicationController
# GET /wrestlers/new
def new
@wrestler = Wrestler.new
if params[:school]
@school = params[:school]
end
end
# GET /wrestlers/1/edit

View File

@@ -18,7 +18,7 @@
<br>
<br>
<%= link_to "New #{@school.name} Wrestler" , new_wrestler_path(@school) %>
<%= link_to "New #{@school.name} Wrestler" , "/wrestlers/new?school=#{@school.id}" %>
<br>
<br>

View File

@@ -15,12 +15,15 @@
<%= f.label :name %><br>
<%= f.text_field :name %>
</div>
<% if @school %>
<%= f.hidden_field :school_id, :value => @school %>
<% else %>
<div class="field">
<%= f.label 'School' %><br>
<%= f.collection_select :school_id, School.all, :id, :name %>
</div>
<% end %>
<div class="field">
<%= f.label 'Weight Class' %><br>