Combining two arrays

I assume you mean’t Hashes and not Arrays?

This assumes the elements are in the same order:

names = {:one => “one”, :two => “two”}
data = {“one” => “foo”, “two” => “bar”}

hash = {}
names.values.zip(data.values).each {|key, value| hash[key] = value}
hash
=> {“two”=>“bar”, “one”=>“foo”}

Array#zip

Or, a join.

I’d go with a JOIN, it’s no doubt faster.