26 lines
537 B
Ruby
26 lines
537 B
Ruby
class Videos::ReportPublicationsController < ApplicationController
|
|
before_action :set_video
|
|
|
|
def create
|
|
@video.publish_report!
|
|
|
|
redirect_to [@video, :video_analyses], notice: "Report has been published"
|
|
end
|
|
|
|
def destroy
|
|
@video.unpublish_report!
|
|
|
|
redirect_to [@video, :video_analyses], notice: "Report has been un-published"
|
|
end
|
|
|
|
private
|
|
|
|
def videos
|
|
policy_scope(Video)
|
|
end
|
|
|
|
def set_video
|
|
@video = authorize videos.find(params[:video_id]), policy_class: Videos::ReportPublicationPolicy
|
|
end
|
|
end
|