Created
July 28, 2013 23:41
-
-
Save admc/6100750 to your computer and use it in GitHub Desktop.
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
var User = function () { | |
this.hasMany('Messages'); | |
this.hasMany('Conversations', {through: 'Messages'}); | |
}; | |
var Conversation = function () { | |
this.hasMany('Memberships'); | |
this.hasMany('Users', {through: 'ConversationMemberships'}); | |
}; | |
var Message = function () { | |
this.belongsTo('Users'); | |
this.belongsTo('ConversationMembership'); | |
}; | |
var ConversationMembership = 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