# frozen_string_literal: true # API Controller for resources of PaymentSchedule class API::PaymentSchedulesController < API::ApiController before_action :authenticate_user! before_action :set_payment_schedule, only: %i[download] def download authorize @payment_schedule send_file File.join(Rails.root, @payment_schedule.file), type: 'application/pdf', disposition: 'attachment' end private def set_payment_schedule @payment_schedule = PaymentSchedule.find(params[:id]) end end