node-persist icon indicating copy to clipboard operation
node-persist copied to clipboard

Model events not fired when using Model.update(conn,id,data,callback)

Open lbrucher opened this issue 12 years ago • 0 comments

The events do however get fired when calling update() on a model instance. I understand that in the Model.update() case we don't have an instance to pass to the event methods but maybe we could pass the 'data' argument? And maybe add an extra param to the event method to indicate the given obj is a partial or a full instance?

Currently this make the use of Model.update() limited and not practical when registering those events. In my case, I have defined a beforeSave event to update a 'updated_at' datetime field on model instances. The fact that Model.update() does not fire the event makes this method essentially useless to me. Or should this be handled/implemented in a different way?

Happy to send a pull request if you guys think this could make sense?

lbrucher avatar Apr 04 '13 15:04 lbrucher