diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 2f3c344cb..c82b9a385 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -122,7 +122,7 @@ class PollController < ApplicationController ################ๅค็้้กน if params[:question_answer] @poll_question.poll_answers.each do |answer| - @poll_question.poll_answers.destroy answer unless params[:question_answer].keys.include? answer.id.to_s + answer.destroy unless params[:question_answer].keys.include? answer.id.to_s end for i in 1..params[:question_answer].count question = @poll_question.poll_answers.find_by_id params[:question_answer].keys[i-1] diff --git a/app/views/poll/_poll_question.html.erb b/app/views/poll/_poll_question.html.erb new file mode 100644 index 000000000..7731c9821 --- /dev/null +++ b/app/views/poll/_poll_question.html.erb @@ -0,0 +1,12 @@ +
+<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %> +