Files
grecia/app/controllers/admin/poll/questions/answers/documents_controller.rb
Javi Martín 629e208e9d Add and apply ArgumentAlignment rubocop rule
We're choosing the default `with_first_argument` style because it's the
one we use the most.
2023-08-18 14:56:16 +02:00

31 lines
686 B
Ruby

class Admin::Poll::Questions::Answers::DocumentsController < Admin::Poll::BaseController
include DocumentAttributes
load_and_authorize_resource :answer, class: "::Poll::Question::Answer"
def index
end
def create
@answer.attributes = documents_params
authorize! :update, @answer
if @answer.save
redirect_to admin_answer_documents_path(@answer),
notice: t("admin.documents.create.success_notice")
else
render :index
end
end
private
def documents_params
params.require(:poll_question_answer).permit(allowed_params)
end
def allowed_params
[documents_attributes: document_attributes]
end
end