DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Force Output To Download As A File In Rails

05.16.2006
| 22427 views |
  • submit to reddit
        
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'