Search code examples
ruby-on-railseventsdestroy

Keeping track of destroyed objects


I searched stack-overflow for similar approaches and didn't find anything so here goes my question:

I need to be able to keep track if a destroy has happened on a object and the time it happened. I also don't really need the whole object just the id it had.

Is there a gem that does this or do it need to handle this in my database?


Solution

  • If you don't mind keeping the records around, you could use the paranoia gem, which adds a deleted_at timestamp and scopes the models using it so deleted records are excluded by default.