Skip to content

Instantly share code, notes, and snippets.

@oscaroceguera
Last active November 27, 2015 23:59
Show Gist options
  • Save oscaroceguera/a33f8e5538a37559fbf7 to your computer and use it in GitHub Desktop.
Save oscaroceguera/a33f8e5538a37559fbf7 to your computer and use it in GitHub Desktop.
category model
var Bookshelf = require('../commons/bookshelf');
Bookshelf.plugin('registry');
var Post = require('./post');
var Category = Bookshelf.Model.extend({
tableName: 'categories',
hasTimestamps: true,
posts : function () {
return this.hasMany('Post');
}
});
module.exports = Bookshelf.model('Category', Category);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment