class VideoAnalyses::AppearanceReleasesController < ApplicationController
  before_action :set_video

  def index
    @appearance_releases = filtered_releases
  end

  private

  def set_video
    @video = Video.find(params[:video_id])
  end

  def query_param
    params[:query]
  end
  
  def filtered_releases
    results = policy_scope(@video.appearance_releases)
      
    if query_param.present?
      results = results.search(query_param)
    end

    results
  end
end
