Sha256: ec25630986e8cc74f6e2033679a7db5fb2f1b9a17bb0928a7e5cceda82de723b
Contents?: true
Size: 906 Bytes
Versions: 51
Compression:
Stored size: 906 Bytes
Contents
class Marty::ReportController < Marty::ApplicationController def index format, req_disposition, title = params[:format], params[:disposition], params[:reptitle] raise 'bad format' unless Marty::ContentHandler::GEN_FORMATS.member?(format) data = Marty::ReportForm.run_eval(params) # hacky: shouldn't have error parsing logic here format = 'json' if data.is_a?(Hash) && (data[:error] || data['error']) # hack for testing -- txt -> csv exp_format = format == 'txt' ? 'csv' : format res, type, disposition, filename = Marty::ContentHandler. export(data, exp_format, title) # hack for testing -- set content-type type = 'text/plain' if format == 'txt' && type =~ /csv/ send_data(res, type: type, filename: filename, disposition: req_disposition || disposition, ) end end
Version data entries
51 entries across 51 versions & 1 rubygems