diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb index 498603b..cd10177 100644 --- a/app/controllers/answers_controller.rb +++ b/app/controllers/answers_controller.rb @@ -16,11 +16,12 @@ @question = Question.find(question_id); @answer = Answer.find_by( plan_id: plan_id, - user_id: user_id, question_id: question_id) @old_answer = nil +puts "FOUND: #{@answer.id}" + if @answer.nil? @answer = Answer.new(params[:answer]) @answer.text = params["answer-text-#{@answer.question_id}".to_sym] @@ -36,6 +37,9 @@ @answer.update(params[:answer]) end + +puts "ERRORS: #{@answer.errors.collect{|e,m| "#{e} - #{m}"}.join(', ')}" + @section_id = @answer.question.section.id # these are used for updating the status line