Hey there!
I find a problem that Persistence#update_colums
and Persistence#update_colum
do not update timestamps. Those methods are often used for performance reasons or to skip callbacks/validations, but it’s a common mistake to forget to provide updated timestamps. Also, there are no options, other than to provide updated_at/updated_on
(or some other timestamp) explicitly.
So there are a couple of proposals:
- What do you think about providing a
touch
option similar to what Rails have for Persistence#increment! - Also it will be awesome to change the
update_colums/update_colum
behavior to respect model’srecord_timestamps
configuration as it works ie forPersistence#save
,Persistence#update
, etc. Of course, it may be unexpected, because skipping timestamps update defaulted since introducing those methods and might be configurable. For exampleconfig.update_columns_respects_record_timestamps = true
.
Ideally, it would be nice to have both options, but any of them would be already better than the current situation. Let me know what you think about it!
I’ve been working on this problem for a while, so I will happily open a PR, as soon as it is ready and the team confirms it is a good idea. Thanks!