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| %> + + + + + +<% end %> + \ No newline at end of file diff --git a/app/views/poll/update_poll_question.js.erb b/app/views/poll/update_poll_question.js.erb index 267a27ae2..39d0fcfd6 100644 --- a/app/views/poll/update_poll_question.js.erb +++ b/app/views/poll/update_poll_question.js.erb @@ -1,2 +1,6 @@ - -pollQuestionCancel(<%= @poll_question.id%>); \ No newline at end of file +$("#poll_questions_<%= @poll_question.id%>").html("
" + + "<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_question}) %>" + + "
" + + "");