Skip to content

Commit 4b7a08f

Browse files
authored
Merge pull request #80 from xn/add_documentation_for_error_formatter
add documentation for error formatter
2 parents b265419 + 8b8da16 commit 4b7a08f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ require 'grape-active_model_serializers'
3636
class API < Grape::API
3737
format :json
3838
formatter :json, Grape::Formatter::ActiveModelSerializers
39+
40+
# Serializes errors with ActiveModel::Serializer::ErrorSerializer if an ActiveModel.
41+
# Serializer conforms to the adapter, ex: json, jsonapi.
42+
# So an error formatted with a jsonapi formatter would render as per:
43+
# http://jsonapi.org/format/#error-objects
44+
error_formatter :json, Grape::Formatter::ActiveModelSerializers
3945
end
4046
```
4147

0 commit comments

Comments
 (0)