我如何定义 hasMany Space -> Accounts 关系?
var Space = Bookshelf.Model.extend({
tableName : 'spaces',
// Account variable does not exist :/
});
var Account = Bookshelf.Model.extend({
tableName : 'accounts',
spaceId : function() {
return this.belongsTo(Space);
},
});
定义这个的正确方法是什么?
PS书架js库没有标签:http: //bookshelfjs.org/