A simplified version of the data models I'm working with:
Browser
var Browser = DS.Model.extend({
name: DS.attr('string'),
versions: DS.hasMany('version', {async: true}),
});
Version
var Version = DS.Model.extend({
browser: DS.belongsTo('browser', {async: true}),
number: DS.attr('string'),
supports: DS.hasMany('support', {async: true}),
}
Support
var Support = DS.Model.extend({
support: DS.attr('string'), // yes, no, partial
version: DS.belongsTo('version', {async: true}),
feature: DS.belongsTo('feature', {async: true})
});
Feature
var Feature = DS.Model.extend({
name: DS.attr('string'),
supports: DS.hasMany('support', {async: true}),
});
I want to allow the user to select a feature and then display support information for all browser versions. Something like this:
Support for featureName in browserName:
- version 4: yes
- version 3: partial
- version 2: no
- version 1: no
My current setup has nested routes features/:feature_id/:browser_id
I will have all of the records for browser
and version
but there are too many records in support
to download them all from the API.
How can I loop through all the browser.versions
and display all the feature.supports
that match that version?