gpt4 book ai didi

ruby-on-rails - 在不更改任何内容的情况下更新 updated_at

转载 作者:行者123 更新时间:2023-12-04 00:09:44 26 4
gpt4 key购买 nike

有什么办法可以触摸导致 updated_at 的模型吗?字段更新到当前时间而不实际更改其他字段中的任何内容?

最佳答案

您可以使用 touch

model.touch

或者
model.touch(:updated_at) #or anyother timestamp attribute

文档 here

关于ruby-on-rails - 在不更改任何内容的情况下更新 updated_at,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25294768/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com