Files
nairobi/app/controllers/polls/answers_controller.rb
Senén Rodero Rodríguez 7df0e9a961 Allow to remove poll answers
2022-10-18 11:04:40 +02:00

20 lines
533 B
Ruby

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