diff --git a/app/controllers/admin/poll/questions/answers_controller.rb b/app/controllers/admin/poll/questions/answers_controller.rb index 9223e65d4..e4d8869c0 100644 --- a/app/controllers/admin/poll/questions/answers_controller.rb +++ b/app/controllers/admin/poll/questions/answers_controller.rb @@ -1,5 +1,4 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController - before_action :load_question before_action :load_answer, only: [:update, :documents] load_and_authorize_resource :question, class: "::Poll::Question" @@ -43,7 +42,4 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController @answer = ::Poll::Question::Answer.find(params[:id] || params[:answer_id]) end - def load_question - @question = ::Poll::Question.find(params[:question_id]) - end end diff --git a/app/views/admin/poll/questions/answers/documents.html.erb b/app/views/admin/poll/questions/answers/documents.html.erb index d9036b163..ba2a6193b 100644 --- a/app/views/admin/poll/questions/answers/documents.html.erb +++ b/app/views/admin/poll/questions/answers/documents.html.erb @@ -3,18 +3,17 @@

<%= t("admin.questions.show.answers.documents_list") %>

-
- <%= form_for(@answer, url: admin_question_answer_path(@question, @answer)) do |f| %> +
+ <%= form_for(Poll::Question::Answer.new, + url: admin_answer_documents_path(@answer), + method: :post) do |f| %> <%= render 'shared/errors', resource: @answer %> - <%= f.hidden_field :question_id, value: @question.id %> -