Allows restoring your Active Records from the dead!
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install zombie_record
Simply include the
ZombieRecord::Restorable in your model class:
class Book < ::Base include :: end
Zombie Record assumes the model's table has a
deleted_at column with the
You can now delete and restore Book records:
book = Book.find(42) book.destroy Book.find(42) # raises ActiveRecord::RecordNotFound. book = Book.deleted.find(42) book.restore! Book.find(42) # returns the Book record.
Zombie Record only works with Active Record >= 4. For Active Record 3 compatibility, check out the activerecord-3 branch of this gem.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request