I'm currently developing a simple Ember / Rails application that involves multiple nested relationships. For instance:
class Release < ActiveRecord::Base
has_many :tracks
end
Upon accessing my Releases endpoint, I receive JSON data in the following format:
{
releases: [{
id: 1,
name: "Release Name",
artist: "Artist Name",
tracks: [{
id: 1,
name: "Track 1",
},
{
id: 2,
name: "Track 2",
}]
}]
}
I have done extensive research online but haven't found a solution yet. How can I link the "Track" model to Ember so that I can simultaneously display a release with its associated tracks?
Should I use DS.hasMany
, set async:true
, or utilize embedded:true
? None of these approaches seem to be effective for me.
Versions:
- Ember: 1.4.0-beta.1+canary.011b67b8
- Ember Data: 1.0.0-beta.5+canary.d9ce2a53
- Handlebars: 1.1.1
- jQuery: 1.10.2