Last active
August 29, 2015 14:14
-
-
Save bjyoungblood/6c3c5cda125020331995 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
// This happens in the main application | |
'use strict'; | |
var base = require('cah-base-model'); | |
base.init(Bookshelf.PG); | |
var userModule = require('users-module'); | |
userModule.initModels(base); | |
var User = userModule.models.User; | |
var myUser = new User.Model({ id : 1 }).fetch(); |
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
// This is its own module | |
'use strict'; | |
var Model; | |
var Collection; | |
exports.init = function(bookshelf) { | |
Model = bookshelf.Model.extend(...); | |
Collection = bookshelf.Collection.extend(...); | |
}; | |
exports.Model = Model; | |
exports.Collection = Collection; |
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
// This is a model inside of a module | |
var Model; | |
var Collection; | |
exports.init = function(base) { | |
Model = base.Model.extend({}, {}); | |
Collection = base.Model.extend({}, {}); | |
}; | |
exports.Model = Model; | |
exports.Collection = Collection; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment