在acts_as_commentable_with_threading

时间:2016-08-22 00:25:24

标签: ruby-on-rails devise acts-as-commentable

我正在使用acts_as_commentable_with_threading。我正在使用设计允许用户停用其帐户而不是删除。我仍在使用设计销毁操作来执行此操作,因此会发送删除请求。

gem似乎删除了用户拥有的所有注释,我想阻止它。我想我已经在gem here中找到了这种情况,但我不确定。我已粘贴下面的代码:

module ClassMethods
  def acts_as_commentable
    has_many :comment_threads, class_name: 'Comment', as: :commentable
    before_destroy { |record| record.root_comments.destroy_all }
    include Acts::CommentableWithThreading::LocalInstanceMethods
    extend Acts::CommentableWithThreading::SingletonMethods
  end
end

我认为这一切都是因为before_destroy回调而发生的。我怎样才能防止这种情况发生?

0 个答案:

没有答案