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