[Rails] Re: Hash each where

2011-06-30 Thread Andrew Skegg
Sebastian writes: > > Thank you, > > that was exactly what I was looking for!!! > Further to the solution provided, if the data is coming from a database, then you can create some scopes to filter the information for you. It might be faster than looping through the array. -- You received

[Rails] Re: Hash each where

2011-06-30 Thread Sebastian
Thank you, that was exactly what I was looking for!!! On 30 Jun., 15:16, Paulo Muggler Moreira wrote: > John's answer. Also, the Ruby Hash > API > . > > > > > > > > On Thu, Jun 30, 2011 at 10:10, John Feminella wrote: > > only_new_entries = array

Re: [Rails] Re: Hash each where

2011-06-30 Thread Paulo Muggler Moreira
John's answer. Also, the Ruby Hash API . On Thu, Jun 30, 2011 at 10:10, John Feminella wrote: > only_new_entries = array_of_hashes.select { |h| h[:status] == "new" } > > ~ jf > -- > John Feminella > Principal Consultant, BitsBuilder > LI: http://ww

Re: [Rails] Re: Hash each where

2011-06-30 Thread John Feminella
only_new_entries = array_of_hashes.select { |h| h[:status] == "new" } ~ jf -- John Feminella Principal Consultant, BitsBuilder LI: http://www.linkedin.com/in/johnxf SO: http://stackoverflow.com/users/75170/ On Thu, Jun 30, 2011 at 09:07, Sebastian wrote: > Sorry, > > yes I have an array of has

[Rails] Re: Hash each where

2011-06-30 Thread Sebastian
Sorry, yes I have an array of hashes: hash = [{:name => "like", :status => "old"}, {:name => "this", :status => "new"}, {:name => "here", :status => "old"}] On 30 Jun., 14:31, Michael Pavling wrote: > On 30 June 2011 13:27, Sebastian wrote: > > > I have a hash that has a :status key. The v