Use methods defined on models as sort keys.

I ran into a use-case, were I'd like to sort table columns based on some methods defined on my model. For example, I have a model method, that does some aggregations over related model fields and I want the sort key to be this method's result.
I wrote a little patch that works for me and I think this feature is quite useful. Maybe someone else does too?