Is there an option to not touch the updated_at attribute when i update an attribute in mongoid ?
Something similar to model.save(validate: false) or, better, model.update_attribute(:attribute, 'value') ?
Is there an option to not touch the updated_at attribute when i update an attribute in mongoid ?
Something similar to model.save(validate: false) or, better, model.update_attribute(:attribute, 'value') ?
On
You can use the update_column method:
https://apidock.com/rails/v3.1.0/ActiveRecord/Persistence/update_column
Validations are skipped.
Callbacks are skipped.
updated_at/updated_on are not updated.
I just found my answer here : https://github.com/mongoid/mongoid/blob/v3.1.7/lib/mongoid/timestamps/timeless.rb
If anyone is interested, you can use
model.timelessto skip updating created or update date, andmodel.clear_timeless_optionto reactivate it !