Lets say I have the following DataMapper resources:
class Post
include DataMapper::Resource
has n, :comments
...
end
class Comment
include DataMapper::Resource
belongs_to :post
...
end
To get the ordered list of posts, I know you can do:
@posts = Posts.all(:order => :date.desc)
But lets say I want to display all the Posts ordered descending by how many comments they have. How would I do that?