我有这个简单的模型:
class Post < ApplicationRecord
after_create_commit :process
before_save :re_process, on: :update
has_one :processed, class_name: 'Post::Process'
def process
self.processed.destroy if self.processed
processed = self.build_processed
processed.save!
end
private
def re_process
self.process if self.title_changed?
end
end
每次Stack level to deep
创建新的Post
.
现在,当我删除before_save :re_process, on: :update
一切工作正常。
这条线不应该只在我更新帖子时生效吗?