我正在进行一个基于SailsJS的项目,但现在我正在为一个文档编写更新过程,当我这样做时,得到了以下错误。
{
"code": "E_VALIDATION",
"invalidAttributes": {
"deleted": [
{
"rule": "boolean",
"message": "\"boolean\" validation rule failed for input: 'true'\nSpecifically, it threw an error. Details:\n undefined"
}
]}
}
在模型中,我
deleted: {
type: 'string',
boolean: true
}
在控制器中
//删除指定用户的操作
销毁:函数(req、res、next){
// Logs actions details
sails.log.info("Attempting to delete user ( " , req.param('id') , " ) from IP (IP adddress: " , req.ip , ")" );
User.update({
id: req.param('id')
}, {
deleted: true
}).exec(function (err, user) {
if (err) {
// Handles the response containing some error
ErrorHandler.response(err, req, res, next);
}
res.json(user);
});
}