2

I'm using the paranoia / acts_as_paranoid gem to soft delete my models.

I have a 1 to many relationship between posts and comments. They are both paranoid and on destroy everything works as expected.

My relationships are set up like this:

acts_as_commentable // in the post model
belongs_to :commentable, :polymorphic => true // in Comment model

I'm using the acts_as_commentable_with_threading gem for the comments.

Here's a sample of commands to illustrate the issue:

post.comments.count //8
post.destroy // this soft deletes the post and its comments
post.restore(:recursive => true) // this only restores the post
post.comments.count // 0
post.comments.with_deleted.count // 8

Thanks!

mrk
  • 75
  • 8

1 Answers1

0

I had the same issue, turns out I had forgotten to write 'acts_as_paranoid' in the model

Anjan
  • 386
  • 2
  • 13