Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var uuid = require('node-uuid')
var M = {}
M.BaseModel = Class(M, 'BaseModel').inherits(Krypton.Model)({
primaryKey: 'uuid',
prototype: {
init: function (config) {, config)
var that = this
this.on('onBeforeCreate', function (next) {
var buffer = new Buffer(16)
uuid.v4(null, buffer)
that.uuid = uuid.unparse(buffer)
return next()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.