Use constructor to reference the model class
This commit is contained in:
parent
6b4ebdf609
commit
a6ff4b0cad
|
@ -136,7 +136,8 @@ var User = module.exports = Model.extend('User', properties, options);
|
||||||
* @param {AccessToken} token The generated access token object
|
* @param {AccessToken} token The generated access token object
|
||||||
*/
|
*/
|
||||||
User.prototype.createAccessToken = function(ttl, cb) {
|
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({
|
this.accessTokens.create({
|
||||||
ttl: ttl
|
ttl: ttl
|
||||||
}, cb);
|
}, cb);
|
||||||
|
|
Loading…
Reference in New Issue