My table field names are lowercase and the field names I get from CSV files are camelcase. Is there anyway I can convert the keys of an array of hashes to lowercase?
I found that this solution is significantly faster and a bit more "Rubyish".
CSV.foreach(file, :headers => true) do |row| new_hash = Hash[row.to_hash.map { |k, v| [k.downcase, v] }] Users.create!(new_hash) end