I actually deemed that the issue was in how i was orchestrating my SQL query, which worked sometimes and not others. It turns out that if I put the user_id condition in :conditions (or in the SQL WHERE clause), it didn't work, but if I put it in the :joins or (JOIN..ON) clause, it did, so even my SQL in my question is not correct and will not yield a list of all "items" with the user_id left NULL for non-compliant users, so:
SELECT ... LEFT JOIN users ON favorites.item_id=items.id
SELECT ... LEFT JOIN users ON favorites.item_id=items.id
This basic thing can be reproduced using :joins => 'LEFT JOIN ....ON...AND' and leaving the user_id stipulation out of the :conditions part of the hash as well. Thank you for looking at this.
Main Topics
Browse All Topics





by: wesgarrisonPosted on 2009-04-05 at 21:07:53ID: 24074302
Select allOpen in new window