📜  如何在 Rails 中写入 CSV 文件 - Ruby 代码示例

📅  最后修改于: 2022-03-11 15:04:50.085000             🧑  作者: Mango

代码示例1
require 'csv'
file = "my_file.csv"
CSV.open( file, 'w' ) do |writer|
  @coun.each do |c|
    writer << [c.name, c.country_code, c.user_id, c.subscriber_id]
  end
end