Allow to remove poll answers
This commit is contained in:
19
app/controllers/polls/answers_controller.rb
Normal file
19
app/controllers/polls/answers_controller.rb
Normal 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
|
||||
Reference in New Issue
Block a user