Database row in a hash

Moin!

Robert Klemme wrote:

You could do res.fields.zip( tupl ) which yields a nested array:

irb(main):034:0> [“name”,“age”].zip([“john”,20])
=> [[“name”, “john”], [“age”, 20]]

Apparently there’s no std way to turn this into a hash

There is, but it’s a bit obscure:

arr = [“name”,“age”].zip([“john”,20])
Hash[*arr.flatten] # => {“name”=>“john”, “age”=>20}

Regards
robert

More regards,
Florian Gross