Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Replacement for acts_as_paranoid for Rails 3
Ruby
Tag: v0.1.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
Gemfile.lock
README.md
Rakefile
immortal.gemspec

README.md

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:

gem 'immortal'

Usage

class User < ActiveRecord::Base
  include Immortal
end

And add a boolean field called deleted to that model:

class AddDeletedToUsers < ActiveRecord::Migration
  def self.up
    add_column :users, :deleted, :boolean
  end

  def self.down
    remove_column :users, :deleted
  end
end

TODO

  • Add documentation in the code
  • Spec associations
  • Add support for a :with_deleted option in associations, like acts_as_paranoid
  • Improve compatibility with acts_as_paranoid

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
Something went wrong with that request. Please try again.