我試圖以CSV格式的文檔導出我的報告。爲此我使用更快的CSV,但是,我遇到了用於ruby 1.9.3的更快的CSV?
Please switch to Ruby 1.9's standard CSV library.
It's FasterCSV plus support for Ruby 1.9's m17n encoding engine.
錯誤。任何人都可以幫我解決這個錯誤嗎?我的代碼如下
csv_string = FasterCSV.generate do |csv|
csv << ["Client_name", "Created_at", "User type"]
@client_reports.each do |client_reports|
csv << [client_reports.email, client_reports.created_at,client_reports.role_name]
end
end
send_data csv_string,
:type => 'text/csv; charset=iso-8859-1; header=present',
:disposition => "attachment; filename=product_stock.csv"
所以,請幫我用Ruby 1.9.3來解決這個問題。 它在Ruby 1.8.7中很好用。
或者如果你可以建議我任何其他資源,請幫我拿出那個例子嗎?