Hi,
Recently I just upgrade rails from 4.2.0 to 5.0.0, wonder what I need to do to
make send_data downloadable file working again? Now the data displayed in
page instead of downloadable file as before?
Thanks!
Liz
Hi,
Recently I just upgrade rails from 4.2.0 to 5.0.0, wonder what I need to do to
make send_data downloadable file working again? Now the data displayed in
page instead of downloadable file as before?
Thanks!
Liz
You need to post the bit of code that is failing so we can see what you are doing. We are not telepathic. Not large chunks of code just the bit that is failing. Tell us what you expect that bit of code to do and what it actually does.
Colin
THe part of code is:
def downloadCSV
require ‘csv’
@ary = session[:ary]
csv_string= CSV.generate do |csv|
@ary.each do |t|
csv << [t]
end
end
send_data csv_string,
type: ‘text/csv; charset=iso-8859-1; header=present’,
disposition: ‘attachment’, filename: ‘rannumgenerator.csv’
end
The web applet link is:
http://methodologymedia.psu.edu/most/rannumgenerator/index
You can enter 1000 for N and 13 for C, click compute, get a result page,
which has
Download:
the code above is used for downloading CSV file after click CSV, which works
in rails 4.2.0, now instead of showing the download dialog, all numbers displayed
in the page.
Thanks!
Liz
Issue got fixed after I recreate the project after upgrading rails.
Liz