added save routing

This commit is contained in:
Mark Moser 2016-07-28 09:37:46 -05:00
parent 0950b7eb2a
commit 911c42bcd6
5 changed files with 11 additions and 5 deletions

View File

@ -4,6 +4,9 @@ AllCops:
- db/seeds.rb - db/seeds.rb
- bin/**/* - bin/**/*
Style/AndOr:
Enabled: false
Style/ClassAndModuleChildren: Style/ClassAndModuleChildren:
Exclude: Exclude:
- test/test_helper.rb - test/test_helper.rb

View File

@ -9,8 +9,7 @@ class CandidateController < ApplicationController
end end
def update_question def update_question
redirect_to :saved and return if params[:save] == 'Save'
redirect_to saved_path if params[:submit] == 'Save'
redirect_to :question redirect_to :question
end end
@ -26,4 +25,10 @@ class CandidateController < ApplicationController
def validate def validate
redirect_to :question redirect_to :question
end end
private
def question_params
params.permit(:save)
end
end end

View File

@ -5,7 +5,6 @@
content_for :footer_title, "Skills Assessment" content_for :footer_title, "Skills Assessment"
%> %>
<form method="post" action="/question">
<%= form_tag(post_question_path) do %> <%= form_tag(post_question_path) do %>
<main class="questions_tpl"> <main class="questions_tpl">
<h2 class="question-text"><%= @question.question %></h2> <h2 class="question-text"><%= @question.question %></h2>

View File

@ -3,11 +3,10 @@ Rails.application.routes.draw do
get "/thankyou", to: "candidate#thankyou", as: :thankyou get "/thankyou", to: "candidate#thankyou", as: :thankyou
get "/saved", to: "candidate#saved", as: :saved get "/saved", to: "candidate#saved", as: :saved
get "/summary", to: "candidate#summary", as: :summary get "/summary", to: "candidate#summary", as: :summary
get "/question", to: "candidate#question", as: :question
post "/question", to: "candidate#update_question", as: :post_question post "/question", to: "candidate#update_question", as: :post_question
get "/question", to: "candidate#question", as: :question
post "/validate", to: "candidate#validate", as: :validate_candidate post "/validate", to: "candidate#validate", as: :validate_candidate
root to: "candidate#welcome" root to: "candidate#welcome"
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end end

BIN
erd.pdf

Binary file not shown.