From: Albert Schlef Date: 2010-02-12T09:24:25+09:00 Subject: Re: Delete Item In Array If Conditions Met Chris Kalaboukis wrote: > Mat Brown wrote: >> The #reject! method is an iterator; so is the for loop (effectively). >> So you're iterating over the array, and then trying to iterate over >> individual members of the array. Here's what you want: >> >> @array = Capture.find(:all) >> @array.reject! { |item| item.text =~ 'something' } > > Thanks guys that did it! You've better ask your question in the Rails forum. You're using some ORM (e.g. AcriveRecord, DataMapper, etc.) and need to ask the people who use it. Instead of loading all the objects from the database it's more efficient to pass find() the criterion. -- Posted via http://www.ruby-forum.com/.