How do you convert an array of hashes to a .csv file?
I have tried
CSV.open(\"data.csv\", \"wb\") do |csv| @data.to_csv end
If the hashes aren't uniform then you will end up with data in the wrong columns. You should use values_at instead:
CSV.open("data.csv", "wb") do |csv| keys = @data.first.keys csv << keys @data.each do |hash| csv << hash.values_at(*keys) end end