From: Martin DeMello Date: 2008-07-15T06:47:29+09:00 Subject: Re: array of hashes (finding value) On Mon, Jul 14, 2008 at 2:37 PM, Nate Leavitt wrote: >>> >>> @invoices.each do |invoice| >>> if invoice[:id] == params[:contact_id] >>> bla... bla... >>> end > > Thanks for the reply. Yes, I am working in rails :) It just seems > kinda tedious to keep iterating over all these collections. Just > wondering if there is a more efficient way. Where did @invoices come from in the first place? If it came from the database, you are probably doing things in your loop that you should be doing in the sql query (e.g. Invoice.find(params[:contact_id]) rather than your if guard in the loop) martin