You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I do a store.findAll('person') or a store.find('group', 178), this works great.
But if I do person.get('group') or group.get('people'), this breaks terribly. The problem is that person.get('group') uses adapter:person (not adapter:group), but serializer:group. Thus, it's receiving active-model-style JSON, but expecting JSON-API.
If I do store.query('group', { include: 'people' }), it breaks in a different way. The JSON-API response for groups comes back with JSON-API documents for the people. It passes these documents to serizlier:person, which expects active-model-style JSON documents.
The text was updated successfully, but these errors were encountered:
Summary
In a hasMany or belongsTo relationship, fetching the associated record(s) will use the source adapter and the foreign serializer.
Example
I have two models:
Person
andGroup
:The
Person
API is classic JSON. TheGroup
API is JSON-API. So I declare adapters and serializers accordingly:If I do a
store.findAll('person')
or astore.find('group', 178)
, this works great.But if I do
person.get('group')
orgroup.get('people')
, this breaks terribly. The problem is thatperson.get('group')
usesadapter:person
(notadapter:group
), butserializer:group
. Thus, it's receiving active-model-style JSON, but expecting JSON-API.If I do
store.query('group', { include: 'people' })
, it breaks in a different way. The JSON-API response for groups comes back with JSON-API documents for the people. It passes these documents toserizlier:person
, which expects active-model-style JSON documents.The text was updated successfully, but these errors were encountered: