11155
(-- --)
1
Hi,
I have a problme with fasterCSV, it isn't rendering columns... I don't
understand why. All my columns are inside the first column the csv file
csv_string = FasterCSV.generate(:col_sep => "\t") do |csv|
# header row
csv << ["id", "Email", "Ville", "Type", "Fréquence"]
# data rows
alerts.each do |alert|
csv << [alert.id, alert.email, alert.city, alert.frequence]
end
end
Rendering:
data = Alert.export_to_csv
send_data data,
:type => 'text/csv; charset=utf-8; header=present',
:disposition => "attachment;
filename=alerts_#{params[:export_kind]}.csv"
Greg
Colin_Law1
(Colin Law)
2
Hi,
I have a problme with fasterCSV, it isn't rendering columns... I don't
understand why. All my columns are inside the first column the csv file
csv_string = FasterCSV.generate(:col_sep => "\t") do |csv|
# header row
csv << ["id", "Email", "Ville", "Type", "Fréquence"]
# data rows
alerts.each do |alert|
csv << [alert.id, alert.email, alert.city, alert.frequence]
end
end
Have you used ruby-debug or similar method to break into here to see
whether csv_string is setup correctly?
Colin
11155
(-- --)
3
Colin Law wrote in post #964287:
Colin_Law1
(Colin Law)
4
So you have no problem with FasterCSV then. What exactly _is_ the problem?
Colin
11155
(-- --)
5
Colin Law wrote in post #964301:
Colin_Law1
(Colin Law)
6
You showed some code earlier for rendering but I did not see where it
is using csv_string. Can you clarify what you are doing with the
string?
Colin