Amber: How do you create a query that filters the property of a record that belongs to a record?

I can not find the answer to this question - so, first post:

Here are the models:

App.File = DS.Model.extend({
  toRender: DS.attr('boolean'),
  dataPoints: DS.hasMany('DataPoint')
});

App.DataPoint = DS.Model.extend({
  file: DS.belongsTo('File'),
  etc: DS.attr('number')
)};

I should be able to select only DataPoints, where etc property = 123, using:

this.store.filter(App.DataPoint, { etc: 123 }, function (datapoint) {
  console.log(datapoint);
});

But how do I change the query to select only the DataPoints where FileTo belongs, is the toRender property set to true?

+3
source share

All Articles