Displaying 1 result from an estimated 1 matches for "show_discuss".
Did you mean:
show_discussed
2006 Apr 03
2
Order By Number of Comments
...omments app from the
screencast. However I am trying to extend the functionality.
I want to be able to display a list of posts and order them by the total
number of comments they have. It will act as a most discussed view.
This is what I have been trying in the controller, with no luck :
def show_discussed
@contents.find(:all, :order => "contents.comment.size DESC", :joins =>
"comments")
end
I have got some SQL that works : (I renamed posts to contents)
select contents.*, count(*) as comment_total from contents, comments
WHERE contents.id = comments.content_id group...