A simple and elegant soft delete solution for Rails applications with a beautiful web interface to manage your deleted records.
Built specifically for Rails developers who need a reliable, beautiful soft delete solution with zero complexity.
Records are marked as deleted instead of being permanently removed. Easy to include in any ActiveRecord model.
Responsive dashboard inspired by Sidekiq's design. View, filter, and manage deleted items with an elegant UI.
Efficient pagination and lazy loading. Handles 5000+ deleted records without breaking a sweat.
Rails generators automate the entire setup. Add soft delete to any model in under 2 minutes.
Select and restore/delete multiple items at once. Filter by model type, time, and more.
Built-in authorization support. Restrict access to admins only or use custom authorization logic.
Get RecycleBin running in your Rails app in just a few steps.
Add RecycleBin to your Rails application:
# Gemfile
gem 'recycle_bin', '~> 1.1'
$ bundle install
Generate configuration and routes:
$ rails generate recycle_bin:install
For each model you want to soft delete:
$ rails generate recycle_bin:add_deleted_at User
$ rails generate recycle_bin:add_deleted_at Post
$ rails db:migrate
Add soft delete capability to your models:
class User < ApplicationRecord
include RecycleBin::SoftDeletable
end
class Post < ApplicationRecord
include RecycleBin::SoftDeletable
end
Your soft delete system is ready:
# Soft delete a record
user = User.find(1)
user.destroy # Goes to trash
# Visit /recycle_bin to manage deleted items
# Restore from code: user.restore
Complete documentation with examples, configuration options, and troubleshooting guide.
Read Docs# Basic Usage
user = User.create(name: "John Doe")
user.destroy # Soft delete
user.deleted? # => true
user.restore # Bring back
user.destroy! # Permanent delete
# Querying
User.all # Active records only (default scope)
User.deleted # Deleted records only
User.with_deleted # All records including deleted
User.restore(123) # Restore by ID
# Configuration
RecycleBin.configure do |config|
config.items_per_page = 50
config.authorize_with do |controller|
controller.current_user&.admin?
end
end