cascading-deletes

Soft and hard delete Ruby on Rails


Ruby on Rails => Implement your own soft delete with the following features:

  1. Should cascade delete

  2. Should be able to permanent delete with a different method. We should have a method to soft and hard delete records.

  3. Remember that the soft delete and hard delete should take care of dependent: :destroy associations as well. Also write tests for these.

Important: Do not use any gems for soft delete feature.?


Solution

  • One of the interesting solutions you can try:

    https://github.com/rubysherpas/paranoia