Couldn't find this specific instance anywhere; I might be missing something simple, but here it goes.
Say I have an array:
["Field1", "Field2"]
I need to convert this into an array of hashes, as such (the FieldType key/value is a default value)
[{"Name"=>"Field1", "FieldType"=>"Text"},
{"Name"=>"Field2", "FieldType"=>"Text"}]
How would I go about doing this? The below clearly doesnt work:
fields.each do |field|
fieldResults << {"Name" => field, "FieldType" => "Text"}
end