Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Force Output To Download As A File In Rails

DZone's Guide to

Force Output To Download As A File In Rails

·
Free Resource

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:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}