1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-11 22:24:21 +01:00
fab-manager/app/controllers/api/payment_schedules_controller.rb

19 lines
507 B
Ruby

# 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