Given this array:
[[{"RepCode"=>"AL20", "ID"=>"eae71dff-3796-4c61-956e-a75a00b01a7b", "Name"=>"Schuh, Eddy", "Folios"=>[]}],
[{"RepCode"=>"ABNX", "ID"=>"637e9117-ed03-45ef-8950-a7220087ee9a", "Name"=>"Eckerson, Kathy", "Folios" => [{"ID"=>"d0cda2be-c142-47d1-9a81-a76c0eea2765"}],
[{"RepCode"=>"ABCD", "ID"=>"637e9117-ed03-45ef-8950-a234902038", "Name"=>"Sarah, Barber", "Folios" => [{"ID"=>"46aafe31-f686-49e2-9d58-c694ea55c14f"}]]
I need to return the ONE array that matches the given id for the Folio key
CODE:
correct_manager = managers.detect do |manager|
manager.first["Folios"].map { |f| f["ID"] == "d0cda2be-c142-47d1-9a81-a76c0eea2765" }
end
That returns:
{"RepCode"=>"AL20", "ID"=>"eae71dff-3796-4c61-956e-a75a00b01a7b", "Name"=>"Schuh, Eddy", "Folios"=>[]}
And I want it to return
{"RepCode"=>"ABNX", "ID"=>"637e9117-ed03-45ef-8950-a7220087ee9a", "Name"=>"Eckerson, Kathy", "Folios" => [{"ID"=>"d0cda2be-c142-47d1-9a81-a76c0eea2765"}
because the ID's match in the detect method.
How can I return the one array that matches the passed in id?
Foliosarrays ever contain more than one Folio?