Skip to content

Commit 8df5b04

Browse files
committed
update integration documentation for ember and JSONAPI to include key_transform underscores to match the attribute and relationship underscore transformations
1 parent a52189c commit 8df5b04

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

docs/integrations/ember-and-json-api.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,30 @@ To solve this, in Ember, both the adapter and the serializer will need some modi
1717

1818
### Server-Side Changes
1919

20-
there are multiple mimetypes for json that should all be parsed similarly, so
20+
First, set the adapter type in an initializer file:
21+
22+
```ruby
23+
# config/initializers/ams_config.rb
24+
ActiveModelSerializers.config.adapter = :json_api
25+
```
26+
27+
or:
28+
29+
```ruby
30+
# config/initializers/ams_config.rb
31+
ActiveModelSerializers.config.adapter = ActiveModelSerializers::Adapter::JsonApi
32+
```
33+
34+
You will also want to set the `key_transform` to `:underscore` since you will adjust the attributes in your Ember serializer to use underscores instead of dashes later.
35+
36+
```ruby
37+
# config/initializers/ams_config.rb
38+
ActiveModelSerializers.config.key_transform = :underscore
39+
```
40+
41+
There are multiple mimetypes for json that should all be parsed similarly, so
2142
in `config/initializers/mime_types.rb`:
43+
2244
```ruby
2345
api_mime_types = %W(
2446
application/vnd.api+json

0 commit comments

Comments
 (0)