Created
November 13, 2013 19:46
-
-
Save jgable/7455167 to your computer and use it in GitHub Desktop.
Posts by tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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...