From 8751a04669333f216c69517f146bcaaad6b0b657 Mon Sep 17 00:00:00 2001 From: Mark Moser Date: Mon, 1 Aug 2016 15:15:57 -0500 Subject: [PATCH] fixed question submission --- app/controllers/candidate_controller.rb | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/app/controllers/candidate_controller.rb b/app/controllers/candidate_controller.rb index e3860dd..6390815 100644 --- a/app/controllers/candidate_controller.rb +++ b/app/controllers/candidate_controller.rb @@ -64,8 +64,7 @@ class CandidateController < ApplicationController def answer_params params.require(:answer).permit( :question_id, :answer_id, - :save, :next, :summary, - :radio, :text, checkbox: [], live_code: [] + :radio, :text, checkbox: [], live_code: [:later, :html, :css, :js] ) end @@ -92,32 +91,32 @@ class CandidateController < ApplicationController def process_text @answer = prep_answer @answer.update(answer: answer_params[:text], - saved: answer_params[:save], - submitted: answer_params[:next]) + saved: params.key?(:save), + submitted: params.key?(:submit)) route_answer end def process_radio @answer = prep_answer @answer.update(answer: answer_params[:radio], - saved: answer_params[:save], - submitted: answer_params[:next]) + saved: params.key?(:save), + submitted: params.key?(:submit)) route_answer end def process_checkbox @answer = prep_answer @answer.update(answer: answer_params[:checkbox], - saved: answer_params[:save], - submitted: answer_params[:next]) + saved: params.key?(:save), + submitted: params.key?(:submit)) route_answer end def process_live_code @answer = prep_answer - @answer.update(answer: answer_params[:live_code], - saved: answer_params[:save], - submitted: answer_params[:next]) + @answer.update(answer: answer_params[:live_code].to_h, + saved: params.key?(:save), + submitted: params.key?(:submit)) route_answer end end