From e8fba379e0ad13c9715fa66d9d100123bea653e9 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Fri, 31 Jan 2014 07:44:05 -0500 Subject: [PATCH] Added seeding criteria to wrestlers --- app/controllers/wrestlers_controller.rb | 2 +- app/views/schools/show.html.erb | 2 ++ app/views/weights/show.html.erb | 2 ++ app/views/wrestlers/_form.html.erb | 5 +++++ db/migrate/20140131123907_add_seed_criteria_to_wrestler.rb | 5 +++++ db/schema.rb | 3 ++- 6 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20140131123907_add_seed_criteria_to_wrestler.rb diff --git a/app/controllers/wrestlers_controller.rb b/app/controllers/wrestlers_controller.rb index 7e09100..e3f3a73 100644 --- a/app/controllers/wrestlers_controller.rb +++ b/app/controllers/wrestlers_controller.rb @@ -102,6 +102,6 @@ class WrestlersController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def wrestler_params - params.require(:wrestler).permit(:name, :school_id, :weight_id, :seed, :original_seed, :season_win, :season_loss) + params.require(:wrestler).permit(:name, :school_id, :weight_id, :seed, :original_seed, :season_win, :season_loss,:criteria) end end diff --git a/app/views/schools/show.html.erb b/app/views/schools/show.html.erb index 463af33..57686bf 100644 --- a/app/views/schools/show.html.erb +++ b/app/views/schools/show.html.erb @@ -37,6 +37,7 @@ Weight Seed Record + Seed Criteria Actions @@ -49,6 +50,7 @@ <%= Weight.find(wrestler.weight_id).max %> <%= wrestler.original_seed %> <%= wrestler.season_win %>-<%= wrestler.season_loss %> + <%= wrestler.criteria %> <% if user_signed_in? %> <%= link_to 'Show', wrestler , :class=>"btn" %> diff --git a/app/views/weights/show.html.erb b/app/views/weights/show.html.erb index 81e073e..16504de 100644 --- a/app/views/weights/show.html.erb +++ b/app/views/weights/show.html.erb @@ -17,6 +17,7 @@ School Seed Record + Seed Criteria Actions for wrestler @@ -28,6 +29,7 @@ <%= School.find(wrestler.school_id).name %> <%= wrestler.original_seed %> <%= wrestler.season_win %>-<%= wrestler.season_loss %> + <%= wrestler.criteria %> <%= link_to 'Show', wrestler , :class=>"btn" %> <% if user_signed_in? %> <%= link_to 'Edit', edit_wrestler_path(wrestler) , :class=>"btn" %> diff --git a/app/views/wrestlers/_form.html.erb b/app/views/wrestlers/_form.html.erb index 14e9726..3e54f86 100644 --- a/app/views/wrestlers/_form.html.erb +++ b/app/views/wrestlers/_form.html.erb @@ -42,6 +42,11 @@ <%= f.number_field :season_loss %> +
+ <%= f.label "Seed Criteria" %>
+ <%= f.text_field :criteria %> +
+
<%= f.submit %>
diff --git a/db/migrate/20140131123907_add_seed_criteria_to_wrestler.rb b/db/migrate/20140131123907_add_seed_criteria_to_wrestler.rb new file mode 100644 index 0000000..2b2ab59 --- /dev/null +++ b/db/migrate/20140131123907_add_seed_criteria_to_wrestler.rb @@ -0,0 +1,5 @@ +class AddSeedCriteriaToWrestler < ActiveRecord::Migration + def change + add_column :wrestlers, :criteria, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index b1cd70e..55a7ab1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140130153634) do +ActiveRecord::Schema.define(version: 20140131123907) do create_table "matches", force: true do |t| t.integer "r_id" @@ -87,6 +87,7 @@ ActiveRecord::Schema.define(version: 20140130153634) do t.datetime "updated_at" t.integer "season_win" t.integer "season_loss" + t.string "criteria" end end