From dbdaec3f312e0ee83987399c50be45d6dc524b4a Mon Sep 17 00:00:00 2001 From: bmv root Date: Fri, 5 May 2017 13:55:37 -0400 Subject: [PATCH] Included add grade form --- .../app/controllers/grades_controller.rb | 11 +++++++++++ Pearlception/app/views/grades/new.html.erb | 18 +++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Pearlception/app/controllers/grades_controller.rb b/Pearlception/app/controllers/grades_controller.rb index b62cf36..5026ce9 100644 --- a/Pearlception/app/controllers/grades_controller.rb +++ b/Pearlception/app/controllers/grades_controller.rb @@ -12,4 +12,15 @@ class GradesController < ApplicationController def deny_to_visitors redirect_to "/signin" unless user_signed_in? && !current_user.admin? end + + def create + Grade.create(grades_params) + redirect_to '/grades' + end + +private + def grades_params + params.require(:grade).permit(:Full_name,:Short_name, :Width_min,:Width_max,:Height_min,:Height_max, :Length_min,:Length_max) + end + end diff --git a/Pearlception/app/views/grades/new.html.erb b/Pearlception/app/views/grades/new.html.erb index f9cea75..a57d277 100644 --- a/Pearlception/app/views/grades/new.html.erb +++ b/Pearlception/app/views/grades/new.html.erb @@ -62,27 +62,27 @@
-
+ <%=csrf_meta_tag%>
- +
- +
- +
- +
@@ -90,13 +90,13 @@
- +
- +
@@ -104,13 +104,13 @@
- +
- +