javascript - How to update record in SailsJS without triggering model lifecycle callbacks -
I have a model where I have to retain the record after updating or saving new records in the table. The problem is that updated updates to UpdateTree are updated after the callback.
module.exports = {id: 'role', attributes: {.}, AfterCreate: function (rec, cb) {fixTree (); CB (); }, AfterUpdate: function (Rick, CB) {fixTree (); CB (); }}} Function fixTree () {/ * code here * / Role.update (....); / I am using controller functions create: function (req, res) {var data = {}; Data.name = req.body.name; Data.parent = req.body.parent; Role.create (data, function (mistake, record) {role.tree.fix (function () {res.ok (record);}}}}); }, Update: Function (Rick, Race) {var data = {}; Data.name = req.body.name; Data.parent = req.body.parent; Role.update (req.params.id, data, function (error, records) {role.tree.fix (function () {res.ok (record);}}}}); },
Comments
Post a Comment