我只想形式读取.csv文件的内容,而不将它们存储在任何地方和履行本我将如何存储文件的内容,而不将其存储
csv_text = File.read('thefiletheychoose') # If this line isnt possible can we store the contents of the csv temp somewhere?
csv = CSV.parse(csv_text, :headers => true)
csv.each do |row|
row = row.to_hash.with_indifferent_access
Company.create!(row.to_hash.symbolize_keys)
end
我有数据库或服务器没有线索的.html会是什么样这个
当你得到一个文件的形式提交你不一定必须从某个地方保存。你可以在内存中读取它并在完成时读取它。 – forker 2012-04-18 11:37:55
你想在客户端做到这一点? – Falcon 2012-04-18 11:39:02
如果可能的话,我会怎样做这个forker目前我所设置的是一个测试csv控制器与索引页 – ahmet 2012-04-18 11:39:43