rails-api/active_model_serializers — pull request #515 by jtomaszewski (2014-02-19 14:52:50+00:00)
Title: Define custom serializer for a class

How to set a serializer for given class, if I don't want to create another serializer with "xxxSerializer" name?

f.e.
```rb
class AbstractImage
def active_model_serializer
ImageSerializer
end
end

class AvatarImage < AbstractImage; end
class CoverImage < AbstractImage; end

# I want all of those classes to be serialized with ImageSerializer, not AbstractImageSerializer, AvatarImageSerializer or DefaultSerializer
```

AFAIR there used to be `#active_model_serializer` method, but seems like it got removed from [ActiveModel::Serializer](https://github.com/rails-api/active_model_serializers/blob/master/lib/active_model/serializer.rb#L42) ? Why?

If there's no particular reason, I'll send a PR fixing it back.