Given two models in an app using DS.RESTAdapter:
App.Calendar = DS.Model.extend({
reservations: DS.hasMany("reservation", { async: true })
});
App.Reservation = DS.Model.extend({
date: DS.attr("date"),
calendar: DS.belongsTo("calendar")
});
And payloads such as:
/api/calendar/1:
{
"calendar": {
"id": 1,
"reservations": [],
"links": {
"reservations": "/api/calendar/1/reservations"
}
}
}
/api/calendar/1/reservations:
{
"reservations": [
{
"id": 1,
"date": "10/01/2014"
}
]
}
Why is it that the reservations array on the Calendar model isn't being lazy-loaded?
Your json shouldn't have reservations defined twice
{
"calendar": {
"id": 1,
"links": {
"reservations": "/api/calendar/1/reservations"
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With