Allows restoring your Active Records from the dead!
Add this line to your application's Gemfile:
gem 'zombie_record'
And then execute:
$ bundle
Or install it yourself as:
$ gem install zombie_record
Simply include the ZombieRecord::Restorable
in your model class:
class Book < ActiveRecord::Base
include ZombieRecord::Restorable
end
Zombie Record assumes the model's table has a deleted_at
column with the timestamp
type.
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.
A new version is published to RubyGems.org every time a change to version.rb
is pushed to the main
branch.
In short, follow these steps:
- Update
version.rb
, - update version in all
Gemfile.lock
files, - merge this change into
main
, and - look at the action for output.
To create a pre-release from a non-main branch:
- change the version in
version.rb
to something like1.2.0.pre.1
or2.0.0.beta.2
, - push this change to your branch,
- go to Actions → “Publish to RubyGems.org” on GitHub,
- click the “Run workflow” button,
- pick your branch from a dropdown.
- 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