Skip to content

Instantly share code, notes, and snippets.

@jgable
Created November 13, 2013 19:46
Show Gist options
  • Save jgable/7455167 to your computer and use it in GitHub Desktop.
Save jgable/7455167 to your computer and use it in GitHub Desktop.
Posts by tag
postsByTag: function (tagId) {
return dataProvider.Tag.findOne({id: tagId}).then(function (found) {
if (!found) {
return when.resolve([]);
}
// TODO: Trim data sent back
return when.resolve(found.related("posts"));
});
}
@fernandez14
Copy link

It does not work any way...

I just tried it using it as a method of the tag API and it did not work.

However I found out a less orthodox method using the Knex interface to generate the query. You should try...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment