ruby-on-railsrubymongoid3

How to update an attribute without touch


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') ?


Solution

  • 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.timeless to skip updating created or update date, and model.clear_timeless_option to reactivate it !