mardi 24 mars 2015

Ember - Querying model by properties in a related model

I'm trying query my post model for published posts that have a specific tag. My models look like this:



var Post = DS.Model.extend({
tags: DS.hasMany('tag', { async: true }),
title: DS.attr('string'),
published: DS.attr('boolean'),
});

var Tag = DS.Model.extend({
posts: DS.hasMany('post', { async: true }),
name: DS.attr('string')
});


I've been able to get published posts in my query using the find() method:



this.get('store').find('post', {published: true});


But I don't understand how to query for properties that are part of a related model. I'd appreciate any guidance, thanks!





Aucun commentaire:

Enregistrer un commentaire