Skip to content

Commit 5301112

Browse files
committed
Merge pull request #1312 from NullVoxPopuli/integration-docs
[DOCS] begin integration docs
2 parents b3b9a46 + 2dc78c5 commit 5301112

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

docs/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ This is the documentation of AMS, it's focused on the **0.10.x version.**
1717
- [How to add root key](howto/add_root_key.md)
1818
- [How to add pagination links](howto/add_pagination_links.md)
1919
- [Using AMS Outside Of Controllers](howto/outside_controller_use.md)
20-
- [How to use JSON API with Ember](howto/ember-and-json-api.md)
20+
21+
## Integrations
22+
| Integration | Supported AMS versions | Gem name and/or link
23+
|----|-----|----
24+
| Ember.js | 0.9.x | [active-model-adapter](https://github.com/ember-data/active-model-adapter)
25+
| Ember.js | 0.10.x + | [docs/integrations/ember-and-json-api.md](integrations/ember-and-json-api.md)
26+
| Grape | 0.10.x + | [#1258](https://github.com/rails-api/active_model_serializers/issues/1258) |
27+
| Grape | 0.9.x | https://github.com/jrhe/grape-active_model_serializers/ |
28+
| Sinatra | 0.9.x | https://github.com/SauloSilva/sinatra-active-model-serializers/
2129

2230
## Getting Help
2331

docs/howto/ember-and-json-api.md renamed to docs/integrations/ember-and-json-api.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# How to use JSON API Query Parameters with Ember
1+
# Integrating with Ember and JSON API
22

33
- [Preparation](./ember-and-json-api.md#preparation)
4-
- [Adapter Changes](./ember-and-json-api.md#adapter-changes)
4+
- [Server-Side Changes](./ember-and-json-api.md#server-side-changes)
5+
- [Adapter Changes](./ember-and-json-api.md#adapter-changes)
56
- [Serializer Changes](./ember-and-json-api.md#serializer-changes)
67
- [Including Nested Resources](./ember-and-json-api.md#including-nested-resources)
78

@@ -12,6 +13,21 @@ Note: This guide assumes that `ember-cli` is used for your ember app.
1213
The JSON API specification calls for hyphens for multi-word separators. AMS uses underscores.
1314
To solve this, in Ember, both the adapter and the serializer will need some modifications:
1415

16+
### Server-Side Changes
17+
18+
there are multiple mimetypes for json that should all be parsed similarly, so
19+
in `config/initializers/mime_types.rb`:
20+
```ruby
21+
api_mime_types = %W(
22+
application/vnd.api+json
23+
text/x-json
24+
application/json
25+
)
26+
27+
Mime::Type.unregister :json
28+
Mime::Type.register 'application/json', :json, api_mime_types
29+
```
30+
1531
### Adapter Changes
1632

1733
```javascript
@@ -34,6 +50,8 @@ export default DS.JSONAPIAdapter.extend({
3450

3551
// allows queries to be sent along with a findRecord
3652
// hopefully Ember / EmberData will soon have this built in
53+
// ember-data issue tracked here:
54+
// https://github.com/emberjs/data/issues/3596
3755
urlForFindRecord(id, modelName, snapshot) {
3856
let url = this._super(...arguments);
3957
let query = Ember.get(snapshot, 'adapterOptions.query');

0 commit comments

Comments
 (0)