Reputation: 18881
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 Hash
es. That is, I have the following Array
of Hash
es:
[
{
: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?
Upvotes: 0
Views: 352