Skip to content

Instantly share code, notes, and snippets.

View stefanhenze's full-sized avatar

Stefan Henze stefanhenze

View GitHub Profile
@stefanhenze
stefanhenze / gist:9821183
Created March 27, 2014 23:10
Bookshelf.js relations
var Parent = Bookshelf.Model.extend({
tableName: 'parent',
child: function() {
return this.hasOne(Child);
}
});
var Child = Bookshelf.Model.extend({
tableName: 'child',
//this has an attribute parent_id