开发者

A one-time generated CSV file in RoR

Is it possible to create a CSV file right out of the command line in IRB or elsewhe开发者_运维知识库re with a one-time use on it. Say, I just need a CSV file with all my user's first name on it.

Can I create that without setting up any architecture?


Yes, use Ruby's csv library (it's part of the standard lib):

http://ruby-doc.org/stdlib/libdoc/csv/rdoc/classes/CSV/Writer.html


What database are you using? It seems doubtful that you'd need to use Rails at all. For example:

How to output MySQL query results in CSV format?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜