When updating to 2.3.4 I noticed that touch is
no longer a simple ‘update :updated_at’, but a save!,
which caused some code to break
(e.g. touch`ing in after_save == loop)
Usage
User.first.touch_without_callbacks User.touch_without_callbacks([User.first.id, User.last.id])
Install
Paste somewhere…
# Provide .touch as it was in 2.3.2, simply update the :updated_at field. class ActiveRecord::Base def touch_without_callbacks now = Time.now.utc self.class.touch_without_callbacks(id, now) self.updated_at = now end def self.touch_without_callbacks(ids, time=Time.now.utc) update_all({:updated_at=>time}, :id=>ids) end end