I have a model company and a model address. company.address
belongs to address. So when I fetch a company record model(params) {return this.store.findRecord('company', params.companyID);}
I can access the address attributes with model.address.street
. But when my backend retruns address: null because the company dosnt have a relationship with an address and I want that the user can set the street by a input field, I get the error Assertion Failed: Cannot delegate set('street', a) to the 'content' property of object proxy <(subclass of Ember.ObjectProxy):ember1458>: its 'content' is undefined."
Here is the json with the null relationship:
{"data": {
"attributes": {"name": "test-company"}, "id": "5",
"relationships": {
"address": {
"data": null
}
},
"type": "companies"
}
}
So how can I avoid this error? I could proof the model.address after fetching the company record if it has an id but doing this in every route isnt really smart.
Aucun commentaire:
Enregistrer un commentaire