Skip to content

Making error serializer implicit by default #1866

Open
@musaffa

Description

Currently we need to write error handler like this:

render json: resource, status: :unprocessable_entity,                                                                                                                                                         
                       serializer: ActiveModel::Serializer::ErrorSerializer

It would have been much better if we could simply write like this:

render json: resource, status: :unprocessable_entity

In the latter case active_model_serializers would need to look for errors in the resource object and if it finds any error in the object then it will implicitly invoke the error serializer unless the user has passed any serializer already.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions