You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any thoughts on supporting some kind of pre-save, and pre-update (and why not pre/post-delete) functionality? Either as functions to override, or events?
As a use case, I've got created_at and updated_at datetimes for my models. Setting the default value works, but e.g. when updating a model, I'd like to automatically set the updated_at to current datetime. Now I have to manually add the timestamp to the model for it to update.
Of course I can make a base class of my own, and override the save and update functions, but it seems a bit overkill. Also a lot of the libraries out there has some kind of functionality for these kind of situations.
Thoughts?
The text was updated successfully, but these errors were encountered:
Any thoughts on supporting some kind of pre-save, and pre-update (and why not pre/post-delete) functionality? Either as functions to override, or events?
As a use case, I've got
created_at
andupdated_at
datetimes for my models. Setting thedefault
value works, but e.g. when updating a model, I'd like to automatically set theupdated_at
to current datetime. Now I have to manually add the timestamp to the model for it to update.Of course I can make a base class of my own, and override the save and update functions, but it seems a bit overkill. Also a lot of the libraries out there has some kind of functionality for these kind of situations.
Thoughts?
The text was updated successfully, but these errors were encountered: