是否可以在 sails.js 中的回调覆盖中获取模型定义?

Is it possible to get model definition in callback override in sails.js?

我正在做类似于 的事情。

我希望能够在回调中引用模型定义,但目前只有属性和 ID 被发送到 afterUpdate。除了添加 'type' 作为属性外,有没有办法确定我正在使用的模型?

正确的作用域加上 this 将在 config/models.js.

中起作用
module.exports.models = {

    attributes: { . . .},

    afterUpdate: function (model) {
        console.log(this.identity);  //model name that triggered callback
        console.log(this.definition); //model definition

        //logic . . .
    }
};