Created
September 29, 2014 20:34
-
-
Save pegli/862cde3bc1c6cbbe117f to your computer and use it in GitHub Desktop.
fetching relations in Alloy model
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
extendModel: function(Model) { | |
_.extend(Model.prototype, { | |
answers: function() { | |
var coll = Alloy.createCollection('answer'); | |
coll.fetch({ query: 'select * from answers where question_id = ' + this.get('id')}); | |
return coll; | |
}, | |
}); | |
return Model; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment