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
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