Hi. I create two models:
Organization:
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr('string'),
tax_id: DS.attr('string'),
address: DS.belongsTo('address'),
created_at: DS.attr('isodate')
});
Address:
import DS from 'ember-data';
export default DS.Model.extend({
line1: DS.attr('string'),
line2: DS.attr('string'),
city: DS.attr('string'),
post_code: DS.attr('string'),
country_code: DS.attr('string'),
organization: DS.belongsTo('address')
});
One serializers Organization:
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
attrs: {
address: { embedded: 'always' }
}
});
And I want view it in table but I get errors:
Error while processing route: organizations.index Assertion Failed: You must include an ‘id’ for undefined in an object passed to ‘push’ Error: Assertion Failed: You must include an ‘id’ for undefined in an object passed to ‘push’ at new Error (native) at Error.EmberError (http://localhost:4200/assets/vendor.js:25883:21) at assert (http://localhost:4200/assets/vendor.js:15784:13) at Object.assert (http://localhost:4200/assets/vendor.js:23185:34) at ember$data$lib$system$store$$Service.extend._pushInternalModel (http://localhost:4200/assets/vendor.js:130163:15) at ember$data$lib$system$store$$Service.extend.push (http://localhost:4200/assets/vendor.js:130149:34) at http://localhost:4200/assets/vendor.js:125034:17 at Object.Backburner.run (http://localhost:4200/assets/vendor.js:10855:25) at ember$data$lib$system$store$$Service.extend._adapterRun (http://localhost:4200/assets/vendor.js:130376:33) at http://localhost:4200/assets/vendor.js:125031:15
Error: Assertion Failed: You must include an ‘id’ for undefined in an object passed to ‘push’ at new Error (native) at Error.EmberError (http://localhost:4200/assets/vendor.js:25883:21) at assert (http://localhost:4200/assets/vendor.js:15784:13) at Object.assert (http://localhost:4200/assets/vendor.js:23185:34) at ember$data$lib$system$store$$Service.extend._pushInternalModel (http://localhost:4200/assets/vendor.js:130163:15) at ember$data$lib$system$store$$Service.extend.push (http://localhost:4200/assets/vendor.js:130149:34) at http://localhost:4200/assets/vendor.js:125034:17 at Object.Backburner.run (http://localhost:4200/assets/vendor.js:10855:25) at ember$data$lib$system$store$$Service.extend._adapterRun (http://localhost:4200/assets/vendor.js:130376:33) at http://localhost:4200/assets/vendor.js:125031:15
How I can fix errors and view data?