node.js - Ember.js data records shows content: null in relationships inspector -


i have following code in 'user.js' model in ember-data:

export default ds.model.extend({   organization: ds.belongsto('organization'),   //other stuff }); 

the crud website working expected, , in mongodb can see following organization field of user:

"organization" : objectid("571974742ce868d575b79d6a"), 

but, , i'm not sure if error in code or me not understanding how ember-data works, cannot access id model hook so:

model(){         return this.store.findrecord("user", this.get("session.currentuser.id"))             .then(user => this.store.findrecord("location", {organization: user.organization}));     } 

and if go ember inspector observe belongsto attribute of user object, see:

organization: <(subclass of ember.objectproxy):ember956> 

but clicking through see content: null

what doing wrong? server-side error?

edit including json response server above findrecord("user") call:

{    "links":{       "self":"/users/5719749a2ce868d575b79d6b"    },    "included":[       {          "type":"organizations",          "id":"571974742ce868d575b79d6a",          "links":{             "self":"/organizations/571974742ce868d575b79d6a"          },          "attributes":{             "creation-date":"2016-04-22t00:46:44.779z"          }       }    ],    "jsonapi":{       "version":"1.0"    },    "data":{       "type":"users",       "id":"5719749a2ce868d575b79d6b",       "links":{          "self":"/users/5719749a2ce868d575b79d6b"       },       "attributes":{          "email":"danthwa@gmail.com",          "first-name":"daniel",          "last-name":"thompson",          "registration-date":"2016-04-22t00:47:22.534z"       },       "relationships":{          "organization":{             "type":"organizations",             "id":"571974742ce868d575b79d6a"          }       }    } } 

confirmed. stated kingpin2k,

the relationships isn't being built correctly, think type , id inside of organization need within data object.

this applies ember sites expecting json api spec payload, meaning have been configured use jsonapiserializer incoming payloads.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -