json - Ember Multitple belongTo relationships not working with JSONAPI -


i have following json api document:

{   "data": [     {       "type": "haves",       "id": "2708f443-0857-4ae9-9935-9aa4b4e9f721",       "attributes": {         "quantity": 1       },       "relationships": {         "card": {           "data": {             "type": "cards",             "id": "3be08f31-3361-404c-9977-23535ed837f3"           }         }       }     }   ],   "included": [     {       "type": "cards",       "id": "3be08f31-3361-404c-9977-23535ed837f3",       "attributes": {         "name": "name"       },       "relationships": {         "set": {           "data": {             "type": "sets",             "id": "0fec70de-02e0-4646-bdcf-f86acea90d23"           }         }       }     },     {       "type": "sets",       "id": "0fec70de-02e0-4646-bdcf-f86acea90d23",       "attributes": {         "name": "name"       }     }   ] } 

with following ember models:

// app/models/have.js export default ds.model.extend({   quantity: ds.attr('number'),   minprice: ds.attr('number'),   account: ds.belongsto('account'),   card: ds.belongsto('card') });  // app/models/set.js export default ds.model.extend({   name: ds.attr('string'),   cards: ds.hasmany('card') });  // app/models/card.js export default ds.model.extend({   name: ds.attr('string'),   set: ds.belongsto('set'),   haves: ds.hasmany('have') }); 

and custom inflector rule:

inflector.irregular('have', 'haves'); 

when load json document structure though, can't seem have.card.set.name in template when iterate jsonapi document. i'm guessing jsonapi structure incorrect. missing? don't errors in chrome console or in ember server running. when load ember inspector, see set model under data.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -