From: daz Date: 2005-11-08T17:07:12+09:00 Subject: Re: an array of hashes Francesco wrote: > Francesco wrote: > > @person.telephones.collect {|x| [] << x.number}.join(', ') > @person.telephones.collect {|x| x.number}.join(', ') > > > Thank you all! You all gave the same answer, > so that must be the correct way :) If you show some sample data, you may see alternatives. Your example with 'x.number' led to the conclusion that 'number' is an accessor into structure other than a Hash. # If 'telephones' really is a Hash {id => num}, e.g. phones = {:home => '00-0001', :office => '00-0002', :mobile => '00-0003'} # then each of these: puts phones.collect {|x| x[1]}.join(', ') puts phones.collect {|k,v| v}.join(', ') puts phones.values.join(', ') # <-- better # gives the same result: #-> 00-0003, 00-0002, 00-0001 If you're happy with what you have already, please ignore. daz