I have an array of hashes that largely contain the same values; but, some of the hashes have additional key value pairs that the others don't. For example the array looks something like
example_array = [{"make" => "nissan", "model" => "altima"}, {"make" => "nissan", "model" => "maxima", "price" => "20,000"}]
My issue comes that I'm trying to export this array of hashes into a CSV. I can't figure out how to
Make sure that the headers of the file has a column/key for every possible key that exists in the array
Make sure that values end up in the correct column
Any help would be greatly appreciated