Updating timestamps with #update_all

Updates all, This method constructs a single SQL UPDATE statement and sends it straight to the database. It does not instantiate the involved models and it does not trigger Active Record callbacks or validations. Values passed to update_all will not go through ActiveRecord's type-casting behavior. It should receive only values that can be passed as-is to the SQL database.

As such, it does not trigger callbacks nor validations - and timestamp update is made in a callback.update_at is a call back for reference http://api.rubyonrails.org/classes/ActiveRecord/Relation.html#method-i-update_all


#update_all does not instantiate models.

As such, it does not trigger callbacks nor validations - and timestamp update is made in a callback.

Edit about edit :

If you want to keep the "one query to rule them all", you can update updated_at as well as :closed :

MyObj.where(:id => ids).update_all(closed: true, updated_at: DateTime.now)

But be aware validations are still not run.