Prevent dependent destroy in acts_as_commentable_with_threading

98 Views Asked by At

I am using acts_as_commentable_with_threading. I am using devise to allow users to deactivate their account instead of delete. I am still using the devise destroy action to do this and so a delete request is sent.

The gem seems to delete all owned comments by the user and I want to prevent this. I think I have found where this happens in the gem here but I am not sure. I've pasted the code below:

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

I think it all happens because of the before_destroy callback. How can I prevent this from happening?

0

There are 0 best solutions below