I have a comment model which has likes associated with it. I keep the likes in a separate table and the comment model has_many likes. However, I want to order the comments by most popular and I do not know how to do an active directory query to return the order I want. I have tried:
Comment.order(:likes.count)
This isn't working. Any advice?