Displaying 1 result from an estimated 1 matches for "clients_array".
2006 Nov 04
0
matching values in arrays
...ients1 = Client.find(:all, :condtions => "id < 10")
clients2 = Client.find(:all, :conditions => "id > 5")
clients3 = Client.find(:all, :conditions => "id in (3, 5, 7, 9, 11)
So I want to find the common clients between them in a common array, I
mean, clients_array has to contain the clients 7 and 9..
I know I can do
clients = clients1.find_all {|x| clients2.find { |y| x.id == y.id} }
clients = clients.find_all {|x| clients3.find { |y| x.id == y.id} }
is there an easy way or a better way to get the same results?
Rodrigo Dominguez
Iplan...