私は2つのインスタンスメソッドで単純なモデルを設定しました。これらのメソッドをライフサイクルコールバックでどのように呼び出すことができますか?Sails/Waterlineのライフサイクルコールバックでモデルインスタンスメソッドを呼び出すにはどうすればよいですか?
module.exports = {
attributes: {
name: {
type: 'string',
required: true
}
// Instance methods
doSomething: function(cb) {
console.log('Lets try ' + this.doAnotherThing('this'));
cb();
},
doAnotherThing: function(input) {
console.log(input);
}
},
beforeUpdate: function(values, cb) {
// This doesn't seem to work...
this.doSomething(function() {
cb();
})
}
};
これはあなたがそれを行う方法を説明していません。彼らは本当に私が心配している限りこれを構築しておくべきです、それは超常用のケースです。 – light24bulbs