I\'m using ActiveModel::Serializer to customize the JSON responses for my API. This works fine in most cases, except when it fails to save a model successfully.
For exa
The class name of resource.errors is ActiveModel::Errors so you have to define you class as ActiveModel::ErrorsSerializer.
ActiveModel::Errors
ActiveModel::ErrorsSerializer
Ref: source code