Displaying 1 result from an estimated 1 matches for "topics_all".
Did you mean:
  topic_all
  
2006 Nov 22
0
Returning objects (not ids) in grouped count
...to get the topic object. What I want is a result like this:
[[#<Topic:0x1234567 ...>, 12], [#<Topic:0x7654321 ...>, 7]]
What I imagine I need is something that generates SQL like this, which 
AR then properly processes into the Topic object:
SELECT count(*) AS count_all, topics.* AS topics_all FROM topics INNER 
JOIN postings ON topics.id = postings.topic_id WHERE (user_id = 1) GROUP 
BY topics.id ORDER BY count_all DESC
Is there a way to do this?
Thanks!
/afb
-- 
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
 You received this message...