Sha256: a2377aa741cb8888bfac0f40b9970bdfc61bfd9dd63cfad3b301470de62078e7
Contents?: true
Size: 717 Bytes
Versions: 4
Compression:
Stored size: 717 Bytes
Contents
class Marty::JobController < ActionController::Base def download job_id = params["job_id"] promise = Marty::Promise.find_by_id(job_id) if promise format = promise.cformat # somewhat hacky: if result has "result" key, it's used as the # content. data = promise.result["result"] || promise.result 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 end
Version data entries
4 entries across 4 versions & 1 rubygems