non-summary question edit bug fix
This commit is contained in:
parent
1ded44610b
commit
eb2eb65219
@ -48,8 +48,8 @@ class QuizController < ApplicationController
|
||||
def answer_params
|
||||
params.require(:answer).permit(
|
||||
:question_id,
|
||||
:answer_id,
|
||||
:answer,
|
||||
:answer_id,
|
||||
answer_array: [],
|
||||
answer_hash: [:later, :html, :css, :js, :text, :other, options: []]
|
||||
)
|
||||
@ -61,8 +61,6 @@ class QuizController < ApplicationController
|
||||
answer[:submitted] = params.key?(:submit)
|
||||
answer[:answer] = answer_params[:answer_array] unless answer_params[:answer_array].nil?
|
||||
answer[:answer] = answer_params[:answer_hash].to_h unless answer_params[:answer_hash].nil?
|
||||
answer.delete(:answer_array)
|
||||
answer.delete(:answer_hash)
|
||||
answer
|
||||
end
|
||||
|
||||
|
@ -7,4 +7,12 @@ class Answer < ApplicationRecord
|
||||
validates :candidate_id, presence: true
|
||||
validates :question_id, presence: true
|
||||
validates :answer, answer_format: true
|
||||
|
||||
# Throw away attributes
|
||||
# convenience for form manipulation
|
||||
def answer_array=(val); end
|
||||
|
||||
def answer_hash=(val); end
|
||||
|
||||
def answer_id=(val); end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user