I am using Ruby on Rails 3.2.2 and I would like to retrieve values related to a hash key present in a Array of Hashes. That is, I have the following Array of Hashes:
[
{
:key1 => value_a_1,
:key2 => value_a_2
},
{
:key1 => value_b_1,
:key2 => value_b_2
},
{
:key1 => value_c_1,
:key2 => value_c_2
}
]
I would like to “retrieve” / “build” the following:
[ value_a_1, value_b_1, value_c_1 ]
How can I make that the proper way?
If
ais the array: