Re: [Rails] Re: Find distinct values in an array of database results

2010-04-26 Thread Franz Strebel
On Mon, Apr 26, 2010 at 10:42 PM, Marnen Laibow-Koser wrote: > [Please quote when replying, so we know what in particular you're > responding to.] > > Vincent M. wrote: >> Sometimes you're not querying a database (for example a REST service >> that returns a json result). Specially in web applicat

[Rails] Re: Find distinct values in an array of database results

2010-04-26 Thread Marnen Laibow-Koser
[Please quote when replying, so we know what in particular you're responding to.] Vincent M. wrote: > Sometimes you're not querying a database (for example a REST service > that returns a json result). Specially in web applications. True. But where you have a database, you should use it. :) Es

[Rails] Re: Find distinct values in an array of database results

2010-04-26 Thread Vincent M.
Sometimes you're not querying a database (for example a REST service that returns a json result). Specially in web applications. On Apr 15, 12:15 pm, Marnen Laibow-Koser wrote: > Christophe Decaux wrote: > > If I may jump in, I'm interested in understanding why you would do this > > kind of datab

Re: [Rails] Re: Find distinct values in an array of database results

2010-04-15 Thread Christophe Decaux
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

Re: [Rails] Re: Find distinct values in an array of database results

2010-04-15 Thread Franz Strebel
On Wed, Apr 14, 2010 at 11:14 PM, joe mejoe 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

[Rails] Re: Find distinct values in an array of database results

2010-04-14 Thread joe mejoe
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 all the columns for "issues" where "status=open". The results would be: 1, open, fred 2, open, john 5, open, john 6, open, sara -- Posted via http://www