mirror of
https://github.com/samsonjs/grape-active_model_serializers.git
synced 2026-04-27 14:57:43 +00:00
Merge pull request #80 from xn/add_documentation_for_error_formatter
add documentation for error formatter
This commit is contained in:
commit
4b7a08fecb
1 changed files with 6 additions and 0 deletions
|
|
@ -36,6 +36,12 @@ require 'grape-active_model_serializers'
|
||||||
class API < Grape::API
|
class API < Grape::API
|
||||||
format :json
|
format :json
|
||||||
formatter :json, Grape::Formatter::ActiveModelSerializers
|
formatter :json, Grape::Formatter::ActiveModelSerializers
|
||||||
|
|
||||||
|
# Serializes errors with ActiveModel::Serializer::ErrorSerializer if an ActiveModel.
|
||||||
|
# Serializer conforms to the adapter, ex: json, jsonapi.
|
||||||
|
# So an error formatted with a jsonapi formatter would render as per:
|
||||||
|
# http://jsonapi.org/format/#error-objects
|
||||||
|
error_formatter :json, Grape::Formatter::ActiveModelSerializers
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue