Skip to content Skip to sidebar Skip to footer

Bookshelf Js Function Inside Extend()

I am using http://bookshelfjs.org/ I added a function inside var User = Bookshelf.Model.extend({ ... // verify the password verifyPassword: function (password, hash, done) { // L

Solution 1:

You need to create an instance of User in your controller

varUser = require('../models/user');
this.user = newUser();

Of if you want your user module to always return an instance then modify it to something like this.

varUser = Bookshelf.Model.extend({
   ...
}
...
module.exports = function(options){ 
  returnnewUser(options) 
};

Post a Comment for "Bookshelf Js Function Inside Extend()"