Dee*_*kor 12 ruby-on-rails ruby-on-rails-4
有什么方法可以触摸模型,导致updated_at字段更新到当前时间而不实际更改其他字段中的任何内容?
ush*_*sha 29
您可以使用 touch
model.touch
Run Code Online (Sandbox Code Playgroud)
要么
model.touch(:updated_at) #or anyother timestamp attribute
Run Code Online (Sandbox Code Playgroud)
文档在这里