10
내가 루비 1.9.2를 사용하고 파일을 CSV로 쓰기도 같은 도서관이 제대로 단지제대로
이
name,country_code,destination,code
Afghanistan,93,Bamain,51
Afghanistan,93,Bamain,52
Afghanistan,93,Bamain,53
Afghanistan,93,Parwan,91
내 코드처럼 CSV에서 작성하려는 그 CSV를 사용하는 방법이
입니다def export_data
@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
end
end
send_file(file)
end
난 내가 CSV 파일에가 끊고이 한숨을 생략 라인 박았 위의 언급이있는
커버 CSV의 모든 행에 "[]는"사전에
Like ["Finland",1,1,2334]
덕분에 ..
은 아마 당신은 설명 할 수 있을까? – Tommyixi