diff --git a/app/controllers/polls/questions_controller.rb b/app/controllers/polls/questions_controller.rb index bebb7ab4a..dcf459485 100644 --- a/app/controllers/polls/questions_controller.rb +++ b/app/controllers/polls/questions_controller.rb @@ -1,7 +1,7 @@ class Polls::QuestionsController < ApplicationController load_and_authorize_resource :poll - load_and_authorize_resource :question, through: :poll + load_and_authorize_resource :question, class: 'Poll::Question', through: :poll def answer partial_result = @question.partial_results.find_or_initialize_by(author: current_user, diff --git a/app/views/poll/questions/_answers.html.erb b/app/views/polls/questions/_answers.html.erb similarity index 94% rename from app/views/poll/questions/_answers.html.erb rename to app/views/polls/questions/_answers.html.erb index 94eed7045..ee76706fc 100644 --- a/app/views/poll/questions/_answers.html.erb +++ b/app/views/polls/questions/_answers.html.erb @@ -8,7 +8,7 @@ <% else %> <%= link_to answer, - answer_poll_question_path(poll_id: question.poll_id, question_id: question.id, answer: answer), + answer_poll_question_path(poll_id: question.poll_id, id: question.id, answer: answer), method: :post, remote: true, class: "button secondary hollow" %> diff --git a/app/views/polls/questions/answer.js.erb b/app/views/polls/questions/answer.js.erb new file mode 100644 index 000000000..aabbd8d89 --- /dev/null +++ b/app/views/polls/questions/answer.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id(@question) %>_answers").html('<%= j render("polls/questions/answers", question: @question) %>'); diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index 6282b112f..ad7818a78 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -30,7 +30,7 @@ <%= question.title %>