Reputation: 4121
To load async relationship ember data payload usually contains links
attribute.
{
"post": {
"id": 1,
"title": "Progressive Enhancement is Dead",
"links": {
"user": "/people/tomdale"
},
},
}
In my case application have to create link itself due to the fact that it operate on date and time selected by the user. Link to the relationship is not fixed. It there any way to change model link
attribute on runtime or do I really need to create whole relationship manually using Ember.$.ajax
?
Upvotes: 0
Views: 70
Reputation: 2824
You can create a serializer to customize the links
field. Example:
App.PostSerializer = DS.RESTSerializer.extend({
normalizePayload: function(payload) {
payload.links = {
"user": getMyLink(payload.links, payload.id)
};
return payload;
}
});
where getMyLink
is your custom function.
Does this address your problem?
Upvotes: 1