There isn't currently any great way of doing this that I know of, unfortunately. There are two options which we've used, one is to use a dependent property, like this:
class Post
@hasMany "comments"
@property "sortedComments", get: -> @comments.clone().sortBy("title")
The other is to keep the collection sorted through some kind of attached event, like this:
class Post
@hasMany "comments"
constructor: ->
super
@comments_property.one =>
@comments.sortBy("title")
@comments_property.one(arguments.callee)
The reason we're doing this in such a convoluted way, using `one` instead of just using `bind`, is because calling `sortBy` would usually trigger a change event, so it would inifitely recurse.
It's a bit painful at the moment, so I really want to find a better way.
/Jonas