Define custom serializer for a resource

This PR is resurrection of #515. Please read conversation there first.

I think this feature is useful for STI models where all descendants can be serialized with same serializer - you would specify it once in base class and then it wouldn't be needed to create serializer class for each descendant and specify serializer again.