Rails更新内容,并不变化 updated_at
正常我们调用 model.save 保存的时候会更新 timestamp,但有些时候我们不希望更新。
>> user.updated_at
=> Wed, 16 Mar 2016 09:15:30 UTC +00:00
>> user.name = "Dan"
>> user.save(touch: false)
UPDATE "users" SET "name" = ? WHERE "users"."id" = ? [["name", "Dan"], ["id", 12]]
=> true
>> user.updated_at
=> Wed, 16 Mar 2016 09:15:30 UTC +00:00