Allow to remove poll answers

This commit is contained in:
Senén Rodero Rodríguez
2022-09-30 18:09:24 +02:00
parent f90d0d9c4d
commit 7df0e9a961
10 changed files with 68 additions and 21 deletions

View File

@@ -0,0 +1,19 @@
class Polls::AnswersController < ApplicationController
load_and_authorize_resource :question, class: "::Poll::Question"
load_and_authorize_resource :answer, class: "::Poll::Answer",
through: :question,
through_association: :answers
def destroy
@answer.destroy!
respond_to do |format|
format.html do
redirect_to request.referer
end
format.js do
render "polls/questions/answers"
end
end
end
end