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
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
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
I agree. This is a job for SELECT DISTINCT, unless you've already got
the recordset stored from a previous operation.
In general, do your DB queries on the DB side.
But I'm kind of amateur.
Thanks to anyone who is willing to put some light for me
Light: many Rails developers don't know how to use a DB properly.