Rails 中的
after_touch
仅当对象被触摸时才会调用:
object.touch # after_touch will be called
在这里您可以找到更多信息。
值得注意的是,在 Rails 7 中,
touch
无论是创建新对象还是更新对象时,after_touch 回调都会起作用。