mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-02 13:24:20 +01:00
14 lines
411 B
Ruby
14 lines
411 B
Ruby
|
class API::ExportsController < API::ApiController
|
||
|
before_action :authenticate_user!
|
||
|
before_action :set_export, only: [:download]
|
||
|
|
||
|
def download
|
||
|
authorize @export
|
||
|
send_file File.join(Rails.root, @export.file), :type => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', :disposition => 'attachment'
|
||
|
end
|
||
|
|
||
|
private
|
||
|
def set_export
|
||
|
@export = Export.find(params[:id])
|
||
|
end
|
||
|
end
|