Over a million developers have joined DZone.

Force Output To Download As A File In Rails

·

response.headers['Content-Type'] = 'text/csv' # I've also seen this for CSV files: 'text/csv; charset=iso-8859-1; header=present'
response.headers['Content-Disposition'] = 'attachment; filename=thefile.csv'
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}