29 lines
556 B
Ruby
29 lines
556 B
Ruby
class VideoAnalyses::AcquiredMediaReleasesController < ApplicationController
|
|
before_action :set_video
|
|
|
|
def index
|
|
@acquired_media_file_infos = filtered_file_infos
|
|
end
|
|
|
|
private
|
|
|
|
def set_video
|
|
@video = Video.find(params[:video_id])
|
|
end
|
|
|
|
def query_param
|
|
params[:query]
|
|
end
|
|
|
|
def filtered_file_infos
|
|
releasables = policy_scope(@video.acquired_media_releases)
|
|
results = FileInfo.where(releasable: releasables)
|
|
|
|
if query_param.present?
|
|
results = results.search_filename(query_param)
|
|
end
|
|
|
|
results
|
|
end
|
|
end
|