:f is a string not symbol. what you want is:

data.select{ |data2| data2[:sex] == :f }






    -- Juanito Fatas


On Wed, Jun 4, 2014 at 2:51 PM, Roelof Wobben <r.wobben / home.nl> wrote:

> Hello,
>
> I have this array of hashes :
>
> data = [
>   {age: 40, sex: :m},
>   {age: 24, sex: :f},
>   {age: 56, sex: :m},
>   {age: 45, sex: :m},
>   {age: 23, sex: :f}
> ]
>
> Now I try to find all the people which sex is female so sex: f
> I did try this :
>
> data.select{ |data2| data2[:sex] == ":f"}
>
> But I do not get any output.
>
> Where did I go wrong here ?
>
> Roelof
>
>