DBから簡単にCSV出力が出来た。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
CSV.generate('choi.txt') do |csv| | |
User.find(:all).each do |user| | |
csv <<[user.id ,user.name] | |
end | |
end |
CSV形式でruby on railsのDBのデータを出力する方法 - YomuKaku Memo