i am using ruby 1.9.2 and also use its csv library.I want to write in csv properly just
@coun = Country.all(:limit => 10)
header = "name,country_code,destination,code"
file = "my_file.csv"
File.open(file, "w") do |csv|
csv << header
@coun.each do |c|
csv << [c.name, c.country_code, c.user_id, c.subscriber_id]
# How puts line break here
csv << "\n"
Stackoverflow requires 30 characters in an answer, but I don't know what more to say.