我有 2 个模型,用户和帖子
class User
include Mongoid::Document
include Mongoid::Paranoia
references_many :posts, :autosave => true, :dependent => :destroy
end
class Post
include Mongoid::Document
referenced_in :user
end
现在当我软删除用户时,我也想软删除帖子。有什么办法可以做到这一点吗?
为了软删除我正在使用Mongoid::Paranoia的文档