Use constructor to reference the model class

This commit is contained in:
Raymond Feng 2014-06-09 15:00:15 -07:00
parent 6b4ebdf609
commit a6ff4b0cad
1 changed files with 2 additions and 1 deletions

View File

@ -136,7 +136,8 @@ var User = module.exports = Model.extend('User', properties, options);
* @param {AccessToken} token The generated access token object
*/
User.prototype.createAccessToken = function(ttl, cb) {
ttl = Math.min(ttl || User.settings.ttl, User.settings.maxTTL);
var userModel = this.constructor;
ttl = Math.min(ttl || userModel.settings.ttl, userModel.settings.maxTTL);
this.accessTokens.create({
ttl: ttl
}, cb);