ember.js - Build dynamic relationship in ember data -


i have access api endpoints get, cannot suggest or apply modifications.

this sample schema of each api:

var person = ds.model.extend {     firstname: ds.attr(),     lastname: ds.attr() }  var credit = ds.model.extend {     name: ds.attr(),     personid: : ds.belongsto('person') }  var debit = ds.model.extend {     name: ds.attr(),     personid: : ds.belongsto('person') } 

i can api/person, api/credit, api/debit individually. after fetching data. want map relationship between person , credit/debit similar this...

var person = ds.model.extend {     firstname: ds.attr(),     lastname: ds.attr(),     **debits: ds.hasmany('debit'),**     **credits: ds.hasmany('credit')** } 

how can accomplish in ember-data?

jsbin - http://emberjs.jsbin.com/gewowucamo/8/edit?html,js,output

everything you're doing work. when load data using store.push() builds related relationships (if exist).

this jsbin gives example of you're doing works.

i believe problem have related using fixtures - , @ guess assume doesn't follow same behaviour/logic when loading data.

fixtures being removed ember (see this pr)


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -