If I may jump in, I'm interested in understanding why you would do this kind of database job with Ruby vs. an extra SQL query. I had the feeling that it would be wiser (and would execute faster) to delegate the job to the database engine
But I'm kind of amateur. Thanks to anyone who is willing to put some light for me Christophe Le 15 avr. 2010 à 10:01, Franz Strebel a écrit : > On Wed, Apr 14, 2010 at 11:14 PM, joe mejoe <li...@ruby-forum.com> wrote: >> In addition to my question above, I'd also like to apply the equivalent >> of a 'where' clause without forcing another SQL query, in order to get > > # modify this as needed > results = Issue.find(...) > > statuses = results.collect(&:status).uniq.sort > > open_issues = results.collect { |i| i.status == 'open' } > > I suggest you read up on the Array class and its methods > collect, uniq and sort which I used here. > > Have fun. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.