【发布时间】:2014-02-01 07:20:38
【问题描述】:
我有一个空白的 Sails 0.9.8 应用程序,带有一个非常基本的模型:
module.exports = {
attributes: {
nickname: 'string',
encryptedPassword: 'string',
beforeCreate: function(values, next){
values.encryptedPassword = "123";
next();
}
}
};
当我从控制台创建新用户时,不会调用 beforeCreate 方法,因此没有创建 encryptedPassword。
我确定我在这里遗漏了一些东西,但找不到什么。有什么想法吗?
【问题讨论】: