Skip to content

Instantly share code, notes, and snippets.

@pegli
Created September 29, 2014 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pegli/862cde3bc1c6cbbe117f to your computer and use it in GitHub Desktop.
Save pegli/862cde3bc1c6cbbe117f to your computer and use it in GitHub Desktop.
fetching relations in Alloy model
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