fixed question submission

This commit is contained in:
Mark Moser 2016-08-01 15:15:57 -05:00
parent 90d0ef9db7
commit 8751a04669

View File

@ -64,8 +64,7 @@ class CandidateController < ApplicationController
def answer_params def answer_params
params.require(:answer).permit( params.require(:answer).permit(
:question_id, :answer_id, :question_id, :answer_id,
:save, :next, :summary, :radio, :text, checkbox: [], live_code: [:later, :html, :css, :js]
:radio, :text, checkbox: [], live_code: []
) )
end end
@ -92,32 +91,32 @@ class CandidateController < ApplicationController
def process_text def process_text
@answer = prep_answer @answer = prep_answer
@answer.update(answer: answer_params[:text], @answer.update(answer: answer_params[:text],
saved: answer_params[:save], saved: params.key?(:save),
submitted: answer_params[:next]) submitted: params.key?(:submit))
route_answer route_answer
end end
def process_radio def process_radio
@answer = prep_answer @answer = prep_answer
@answer.update(answer: answer_params[:radio], @answer.update(answer: answer_params[:radio],
saved: answer_params[:save], saved: params.key?(:save),
submitted: answer_params[:next]) submitted: params.key?(:submit))
route_answer route_answer
end end
def process_checkbox def process_checkbox
@answer = prep_answer @answer = prep_answer
@answer.update(answer: answer_params[:checkbox], @answer.update(answer: answer_params[:checkbox],
saved: answer_params[:save], saved: params.key?(:save),
submitted: answer_params[:next]) submitted: params.key?(:submit))
route_answer route_answer
end end
def process_live_code def process_live_code
@answer = prep_answer @answer = prep_answer
@answer.update(answer: answer_params[:live_code], @answer.update(answer: answer_params[:live_code].to_h,
saved: answer_params[:save], saved: params.key?(:save),
submitted: answer_params[:next]) submitted: params.key?(:submit))
route_answer route_answer
end end
end end