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
gregm
2
On 27 November 2010 14:10, Greg Ma [email protected] wrote:
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
gregm
3
Colin L. wrote in post #964287:
On 27 November 2010 14:10, Greg Ma [email protected] wrote:
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
yes it looks correct
gregm
4
On 27 November 2010 14:56, Greg Ma [email protected] wrote:
Colin
yes it looks correct
So you have no problem with FasterCSV then. What exactly is the
problem?
Colin
gregm
5
Colin L. wrote in post #964301:
On 27 November 2010 14:56, Greg Ma [email protected] wrote:
Colin
yes it looks correct
So you have no problem with FasterCSV then. What exactly is the
problem?
Colin
The problem is the rendering in the CSV. I a supposed to have 4 columns,
but instead I have only one with all the data
gregm
6
On 27 November 2010 16:00, Greg Ma [email protected] wrote:
The problem is the rendering in the CSV. I a supposed to have 4 columns,
but instead I have only one with all the data
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