Skip to content

Instantly share code, notes, and snippets.

@bendrucker
Created December 3, 2013 23:32
Show Gist options
  • Save bendrucker/7779655 to your computer and use it in GitHub Desktop.
Save bendrucker/7779655 to your computer and use it in GitHub Desktop.
./db exports a Bookshelf instance
'use strict'
DB = require './db'
class Model extends DB.Model
constructor: ->
super
if typeof @authorize is 'function'
@on 'saving', @authorize
@on 'fetching', @authorize
@on 'destroying', @authorize
if typeof @validate is 'function'
@on 'saving', @validate
module.exports = Model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment