fixes specs
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
|
class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
|
||||||
before_action :load_answer, only: [:show, :edit, :update, :documents]
|
before_action :load_answer, only: [:show, :edit, :update, :documents]
|
||||||
before_action :load_question, except: [:show, :edit, :update]
|
|
||||||
|
|
||||||
load_and_authorize_resource :question, class: "::Poll::Question"
|
load_and_authorize_resource :question, class: "::Poll::Question"
|
||||||
|
|
||||||
@@ -12,7 +11,7 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
|
|||||||
@answer = ::Poll::Question::Answer.new(answer_params)
|
@answer = ::Poll::Question::Answer.new(answer_params)
|
||||||
|
|
||||||
if @answer.save
|
if @answer.save
|
||||||
redirect_to admin_question_path(@question),
|
redirect_to admin_question_path(@answer.question),
|
||||||
notice: t("flash.actions.create.poll_question_answer")
|
notice: t("flash.actions.create.poll_question_answer")
|
||||||
else
|
else
|
||||||
render :new
|
render :new
|
||||||
@@ -50,8 +49,4 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
|
|||||||
@answer = ::Poll::Question::Answer.find(params[:id] || params[:answer_id])
|
@answer = ::Poll::Question::Answer.find(params[:id] || params[:answer_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_question
|
|
||||||
@question = @answer.question
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user