From: Robert Klemme Date: 2007-11-13T00:08:48+09:00 Subject: Re: array select 2007/11/12, Luca Roma : > i have 2 arrays of objects: dates and places > > dates have attribute place_id > and places have id > > I must to selezionate all places that have id in array of objects dates. > > dates.select{|obj| obj.place_id in places[].id } > > How i can replace "in places[].id " to works it? Create a Set of place ids and test against that when selecting. Alternative use #any? on places to test for a place with the current date's place_id but this is very inefficient. Cheers robert -- use.inject do |as, often| as.you_can - without end