From 982c67eb6dee556880a0cbe5ee4da67b5e7fef42 Mon Sep 17 00:00:00 2001 From: kinseyost Date: Sat, 1 Oct 2016 23:30:06 +0000 Subject: [PATCH] Adds controller for Subjects --- README.md | 4 +++ Tutorial_Docs/C | 0 Tutorial_Docs/controllerCRUD.MD | 0 app/assets/javascripts/subjects.js | 2 ++ app/assets/stylesheets/subjects.css | 4 +++ app/controllers/subjects_controller.rb | 16 +++++++++++ app/helpers/subjects_helper.rb | 2 ++ app/views/subjects/delete.html.erb | 2 ++ app/views/subjects/edit.html.erb | 2 ++ app/views/subjects/index.html.erb | 2 ++ app/views/subjects/new.html.erb | 2 ++ app/views/subjects/show.html.erb | 2 ++ config/routes.rb | 10 +++++++ test/controllers/subjects_controller_test.rb | 29 ++++++++++++++++++++ 14 files changed, 77 insertions(+) create mode 100644 Tutorial_Docs/C create mode 100644 Tutorial_Docs/controllerCRUD.MD create mode 100644 app/assets/javascripts/subjects.js create mode 100644 app/assets/stylesheets/subjects.css create mode 100644 app/controllers/subjects_controller.rb create mode 100644 app/helpers/subjects_helper.rb create mode 100644 app/views/subjects/delete.html.erb create mode 100644 app/views/subjects/edit.html.erb create mode 100644 app/views/subjects/index.html.erb create mode 100644 app/views/subjects/new.html.erb create mode 100644 app/views/subjects/show.html.erb create mode 100644 test/controllers/subjects_controller_test.rb diff --git a/README.md b/README.md index 12bbc14..f3f866d 100644 --- a/README.md +++ b/README.md @@ -222,3 +222,7 @@ To specify enironment: rails console c9 ``` For more info, check out [Rails Console]('./Tutorial_Docs/Rails_Console.MD'). + + +## Controllers and CRUD +Controllers and crud information can be found [here](../Tutorial_Docs/controllerCRUD.MD). \ No newline at end of file diff --git a/Tutorial_Docs/C b/Tutorial_Docs/C new file mode 100644 index 0000000..e69de29 diff --git a/Tutorial_Docs/controllerCRUD.MD b/Tutorial_Docs/controllerCRUD.MD new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/subjects.js b/app/assets/javascripts/subjects.js new file mode 100644 index 0000000..dee720f --- /dev/null +++ b/app/assets/javascripts/subjects.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/subjects.css b/app/assets/stylesheets/subjects.css new file mode 100644 index 0000000..afad32d --- /dev/null +++ b/app/assets/stylesheets/subjects.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb new file mode 100644 index 0000000..60794f5 --- /dev/null +++ b/app/controllers/subjects_controller.rb @@ -0,0 +1,16 @@ +class SubjectsController < ApplicationController + def index + end + + def show + end + + def new + end + + def edit + end + + def delete + end +end diff --git a/app/helpers/subjects_helper.rb b/app/helpers/subjects_helper.rb new file mode 100644 index 0000000..2e47f78 --- /dev/null +++ b/app/helpers/subjects_helper.rb @@ -0,0 +1,2 @@ +module SubjectsHelper +end diff --git a/app/views/subjects/delete.html.erb b/app/views/subjects/delete.html.erb new file mode 100644 index 0000000..a75bd48 --- /dev/null +++ b/app/views/subjects/delete.html.erb @@ -0,0 +1,2 @@ +

Subjects#delete

+

Find me in app/views/subjects/delete.html.erb

diff --git a/app/views/subjects/edit.html.erb b/app/views/subjects/edit.html.erb new file mode 100644 index 0000000..f6e910b --- /dev/null +++ b/app/views/subjects/edit.html.erb @@ -0,0 +1,2 @@ +

Subjects#edit

+

Find me in app/views/subjects/edit.html.erb

diff --git a/app/views/subjects/index.html.erb b/app/views/subjects/index.html.erb new file mode 100644 index 0000000..88241ab --- /dev/null +++ b/app/views/subjects/index.html.erb @@ -0,0 +1,2 @@ +

Subjects#index

+

Find me in app/views/subjects/index.html.erb

diff --git a/app/views/subjects/new.html.erb b/app/views/subjects/new.html.erb new file mode 100644 index 0000000..d02cf37 --- /dev/null +++ b/app/views/subjects/new.html.erb @@ -0,0 +1,2 @@ +

Subjects#new

+

Find me in app/views/subjects/new.html.erb

diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb new file mode 100644 index 0000000..af5711f --- /dev/null +++ b/app/views/subjects/show.html.erb @@ -0,0 +1,2 @@ +

Subjects#show

+

Find me in app/views/subjects/show.html.erb

diff --git a/config/routes.rb b/config/routes.rb index 73ec976..fde465b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,14 @@ Rails.application.routes.draw do + get 'subjects/index' + + get 'subjects/show' + + get 'subjects/new' + + get 'subjects/edit' + + get 'subjects/delete' + # Default route root "demo#index" # get 'demo/index' diff --git a/test/controllers/subjects_controller_test.rb b/test/controllers/subjects_controller_test.rb new file mode 100644 index 0000000..945d579 --- /dev/null +++ b/test/controllers/subjects_controller_test.rb @@ -0,0 +1,29 @@ +require 'test_helper' + +class SubjectsControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get subjects_index_url + assert_response :success + end + + test "should get show" do + get subjects_show_url + assert_response :success + end + + test "should get new" do + get subjects_new_url + assert_response :success + end + + test "should get edit" do + get subjects_edit_url + assert_response :success + end + + test "should get delete" do + get subjects_delete_url + assert_response :success + end + +end