Skip to content

Instantly share code, notes, and snippets.

@mde
Forked from admc/gist:6100677
Last active December 20, 2015 08:29
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 mde/6100679 to your computer and use it in GitHub Desktop.
Save mde/6100679 to your computer and use it in GitHub Desktop.
var User = function () {
this.hasMany('Messages');
this.hasMany('ConversationMemberships');
this.hasMany('Conversations', {through: 'ConversationMembership'});
};
var Conversation = function () {
this.hasMany('Messages');
this.hasMany('ConversationMemberships');
this.hasMany('Users', {through: 'ConversationMembership'});
};
var ConversationMembership = function () {
this.belongsTo('User');
this.belongsTo('Conversation');
};
var Message = function () {
this.belongsTo('User');
this.belongsTo('Conversation');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment