Add load_and_authorize_resource to images controller

This commit is contained in:
taitus
2022-09-09 17:14:55 +02:00
parent 99495a21d2
commit 83e0d4c6b7
4 changed files with 10 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
class Admin::Poll::Questions::Answers::ImagesController < Admin::Poll::BaseController
include ImageAttributes
before_action :load_answer, except: :destroy
load_and_authorize_resource :answer, class: "::Poll::Question::Answer"
def index
end
@@ -38,8 +38,4 @@ class Admin::Poll::Questions::Answers::ImagesController < Admin::Poll::BaseContr
def allowed_params
[:answer_id, images_attributes: image_attributes]
end
def load_answer
@answer = ::Poll::Question::Answer.find(params[:answer_id])
end
end