Let's say I have some simple classes for a twitter-like application:
The user has many messages, and the record belongs to the user.
Now I am trying to get a list of messages for a specific user in date order .
I know that I can get a list of all messages (for all users):
def posts = Post.list([sort: 'dateCreated', order: 'asc', max:10])
But to limit it to my specific user, I need to go to the user I want, and I assume that I need to go from a static call to something like this when I first refer to the user:
def user = User.findByUserId(userId)
def posts = user.posts
, , , , [sort: 'dateCreated', order: 'asc', max: 10] 10 ?
?