ember.js - Ember Data not loading hasMany on store.find() -
i have model 2 hasmany relationships seen below:
ember model:
ds.model.extend({ createdat: ds.attr('date'), updatedat: ds.attr('date'), name: ds.attr('string'), address: ds.attr('string'), city: ds.attr('string'), state: ds.attr('string'), zip: ds.attr('string'), users: ds.hasmany('user',{async:true}), templates: ds.hasmany('template',{async:true}) }); using model, have new templates/controllers/etc setup create new users , new templates. can save new/update existing organizations, when try push objects either users or templates, lose may in other of existing users or templates array.
i can see because loading of organization in controller create new records not pulling in other records, pulls in it's own array, not other, example code on new templates controller:
new template controller
organizations: function(){ return this.store.find('organization'); }.property(), actions: { createtemplate: function() { var self = this; console.log(self.get('organizations')); } } will show templates in console when attached record, not users. vise versa, same code on new users controller not show templates pulling in show users.
what can find return both arrays of relationships. both in database, can see them calling rest api, not when found using ember.
i'm still pretty new ember, appreciated.
thanks.
edit
sample json response server
{ "organization": { "id": 40, "name": "sample business llc", "address": "1234 fun avenue", "city": "happytown", "state": "ne", "zip": "12345", "users": [4,1], "templates": [4,1], "createdat": "2014-02-18t23:10:08.466z", "updatedat": "2014-02-18t23:10:08.466z"} }, "meta": { "href": "http://server/organizations/40" } }
Comments
Post a Comment