GithubHelp home page GithubHelp logo

immortal's Introduction

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

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

CHANGELOG

  • 1.0.5 Use separate internal accessors for with/only_deleted singular association readers
  • 1.0.4 Extract with_deleted singular assoc readers to separate module
  • 1.0.3 Added back feature where using immortal finders doesn't unscope association scopes.
  • 1.0.2 Added with/only_deleted singular association readers (see specs)
  • 1.0.1 Made compatible with Rails 3.1.X
  • 1.0.0 Changed the API, made it compatible with Rails 3.1, removed functionality
  • 0.1.6 Fixing immortal issue 2: with_deleted breaks associations
  • 0.1.5 Add "without deleted" scope to join model by overriding HasManyThroughAssociation#construct_conditions rather than simply adding to has_many conditions.
  • 0.1.4 fix bug where ALL records of any dependent associations were immortally deleted if assocation has :dependant => :delete_all option set
  • 0.1.3 fix bug where join model is not immortal
  • 0.1.2 fix loading issue when the deleted column doesn't exist (or even the table)
  • 0.1.1 fix behavior with has_many :through associations

immortal's People

Contributors

jrom avatar unixcharles avatar fesplugas avatar snmgian avatar

Watchers

 avatar Ivan Etchart avatar Martin Cabrera avatar Ariel Luduena avatar Michel Golffed avatar Marcelo Casiraghi avatar James Cloos avatar Sebastian Suttner avatar Nicolas Suarez avatar  avatar Santiago Doldán avatar  avatar  avatar Jeasmine Nahui avatar Martín Fernández avatar  avatar Matías Cubero avatar Natalia Stele avatar Santiago avatar Lucas Aragno avatar Ignacio Villaverde avatar Diego Muracciole avatar Mauricio Carbajal avatar Javier Buquet avatar Renzo Scuadroni avatar crisis avatar Mauricio Coniglio avatar Franco Simeone avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.