Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/redbooth/immortal
Make any ActiveRecord model paranoid by just including Immortal, and instead of being deleted from the database, the object will just marked as 'deleted' with a boolean field in the database.
https://github.com/redbooth/immortal
Last synced: about 2 months ago
JSON representation
Make any ActiveRecord model paranoid by just including Immortal, and instead of being deleted from the database, the object will just marked as 'deleted' with a boolean field in the database.
- Host: GitHub
- URL: https://github.com/redbooth/immortal
- Owner: redbooth
- License: mit
- Created: 2010-12-17T21:18:11.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2024-04-09T15:22:28.000Z (6 months ago)
- Last Synced: 2024-06-21T15:34:25.902Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 111 KB
- Stars: 59
- Watchers: 53
- Forks: 17
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Immortal
Make any ActiveRecord model paranoid by just including `Immortal`, and instead
of being deleted from the database, the object will just marked as 'deleted'
with a boolean field in the database.## Installation
Add the gem dependency to your Gemfile:
```ruby
gem 'immortal'
```## Usage
```ruby
class User < ActiveRecord::Base
include Immortal
end
```And add a boolean field called `deleted` to that model:
```ruby
class AddDeletedToUsers < ActiveRecord::Migration
def self.up
add_column :users, :deleted, :boolean
enddef self.down
remove_column :users, :deleted
end
end
```## TODO
- Add documentation in the code
## Contributing
If you want to improve immortal
1. Fork the repo
2. Create a topic branch `git checkout -b my_feature`
3. Push it! `git push origin my_feature`
4. Open a pull request