mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
add information about server side changes
This commit is contained in:
parent
21fe3abdfc
commit
2dc78c5916
@ -1,6 +1,7 @@
|
|||||||
# Integrating with Ember and JSON API
|
# Integrating with Ember and JSON API
|
||||||
|
|
||||||
- [Preparation](./ember-and-json-api.md#preparation)
|
- [Preparation](./ember-and-json-api.md#preparation)
|
||||||
|
- [Server-Side Changes](./ember-and-json-api.md#server-side-changes)
|
||||||
- [Adapter Changes](./ember-and-json-api.md#adapter-changes)
|
- [Adapter Changes](./ember-and-json-api.md#adapter-changes)
|
||||||
- [Serializer Changes](./ember-and-json-api.md#serializer-changes)
|
- [Serializer Changes](./ember-and-json-api.md#serializer-changes)
|
||||||
- [Including Nested Resources](./ember-and-json-api.md#including-nested-resources)
|
- [Including Nested Resources](./ember-and-json-api.md#including-nested-resources)
|
||||||
@ -12,6 +13,21 @@ Note: This guide assumes that `ember-cli` is used for your ember app.
|
|||||||
The JSON API specification calls for hyphens for multi-word separators. AMS uses underscores.
|
The JSON API specification calls for hyphens for multi-word separators. AMS uses underscores.
|
||||||
To solve this, in Ember, both the adapter and the serializer will need some modifications:
|
To solve this, in Ember, both the adapter and the serializer will need some modifications:
|
||||||
|
|
||||||
|
### Server-Side Changes
|
||||||
|
|
||||||
|
there are multiple mimetypes for json that should all be parsed similarly, so
|
||||||
|
in `config/initializers/mime_types.rb`:
|
||||||
|
```ruby
|
||||||
|
api_mime_types = %W(
|
||||||
|
application/vnd.api+json
|
||||||
|
text/x-json
|
||||||
|
application/json
|
||||||
|
)
|
||||||
|
|
||||||
|
Mime::Type.unregister :json
|
||||||
|
Mime::Type.register 'application/json', :json, api_mime_types
|
||||||
|
```
|
||||||
|
|
||||||
### Adapter Changes
|
### Adapter Changes
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user