I am facing an issue with the model I have:
Whenever I make a call to this.store.find('history');
A request is sent to http:://www.example.com/api/histories/ and I receive the following JSON response:
{
"tracks":[
{
"id":83,
"title":"Untitled",
"length":148,
"artist_ids":[
],
"album_ids":[
]
},
{
"id":85,
"title":"You want it",
"length":262,
"artist_ids":[
],
"album_ids":[
]
},
...
],
"albums":[
],
"artists":[
],
"histories":[
{
"id":1382220844,
"time_played":"2013-10-20 00:14:04",
"user_id":null,
"track_id":83
},
...
]
}
After fetching the data, both Store.History and Store.Track records are successfully stored.
However, upon inspecting a record from Store.History, the "track" attribute appears to be null.
I have verified that the Store.Track records contain the same IDs as those in the JSON response.
For reference, here are my models:
var attr = DS.attr,
belongsTo = DS.belongsTo,
hasMany = DS.hasMany;
Shoutzor.Album = DS.Model.extend({
...
});
Shoutzor.Artist = DS.Model.extend({
...
});
Shoutzor.User = DS.Model.extend({
...
});
Shoutzor.Track = DS.Model.extend({
...
});
Shoutzor.History = DS.Model.extend({
...
});
If anyone can provide assistance on this matter, it would be highly appreciated.