A Rails gem for soft-deleting records by setting a deleted_at timestamp instead of removing them from the database.
Paranoia is a Ruby gem for Rails applications that implements soft-deletion for ActiveRecord models. It overrides the standard destroy method to set a deleted_at timestamp instead of permanently removing records from the database, allowing data to be recovered or audited later. It solves the problem of accidental data loss by providing a safety net for deletions.
Rails developers who need to retain data for compliance, auditing, or recovery purposes without permanently deleting records from their database.
Developers choose Paranoia for its simplicity and Rails-native approach to soft-deletion, offering essential features like scoping, restoration, and association handling with minimal code. It's a maintained alternative to older acts_as_paranoid implementations.
acts_as_paranoid for Rails 5, 6 and 7
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Implements soft-deletion with minimal code overhead, using familiar Rails patterns like scopes and callbacks, making it easy to drop into existing models.
Provides scopes such as with_deleted, only_deleted, and without_deleted for granular querying, allowing developers to easily include or exclude soft-deleted records as needed.
Automatically handles dependent associations by cascading soft-deletion or permanent destruction, ensuring data consistency without manual intervention.
Includes restore methods with recursive options and recovery windows, enabling efficient recovery of accidentally deleted data and its dependencies.
Overrides ActiveRecord's destroy and delete methods, which can lead to surprising behavior and bugs in code that relies on standard Rails semantics, as noted in the README warning.
Forces manual adjustment of database indexes to maintain performance with soft-deleted records, adding overhead and potential for errors, especially with unique constraints.
The project is no longer accepting new features and only supports bug fixes, limiting its evolution and compatibility with future Rails versions or modern alternatives.