Quantcast
Viewing all articles
Browse latest Browse all 4827

Format of RESTSerializer

@iaskquestions wrote:

What is a good place to find examples or documentation on what the RESTSerializer expects in Ember 2.6x?

I am struggling with the case where I have a model User with

export default Model.extend({
  username: attr(),
  pos: hasMany('pos')
});

My endpoint returns:

{
  "pos": [],
  "user": {
    "id": 3,
    "pos": [],
    "username": "sadfadsf"
  }
}

and that is getting retrieved from my controller with

return Ember.RSVP.hash({this.store.findRecord('user', user)});

However, if I try to pull the empty list of pos from the Ember debugger on that model I get a different object.

$E.user.get('pos')
Class {__ember1469049158432: "ember825", __ember_meta__: Meta}

I suspect that this is a promise that isn't resolved properly?

However, I can grab the username just fine with E.user.get('username').

Any I passing in an incorrect format from the API? What aren't the pos getting resolved?

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4827

Trending Articles