Ruby: select a hash from inside an array

Viewed 25403

I have the following array:

response = [{"label"=>"cat", "name"=>"kitty", "id"=>189955}, {"label" => "dog", "name"=>"rex", "id" => 550081}]

How do I select the hash that contains the label cat? I know response.first will give me the same result, but I want to search the by label.

Thanks!

Deb

2 Answers
Related