2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/marty/job_controller.rb', line 2
def download
job_id = params['job_id']
promise = Marty::Promise.find_by_id(job_id)
if promise
format = promise.cformat
data = promise.result(true)
data = data['result'] || data
title = promise.title
else
format = 'json'
data = { error: "Job not found: #{job_id}" }
title = 'error'
end
res, type, disposition, filename =
Marty::ContentHandler.export(data, format, title)
send_data(res,
type: type,
filename: filename,
disposition: disposition,
)
end
|