public
Description: Mark objects as destroyed instead of deleting them from the database for Ruby on Rails ActiveRecord
Homepage:
Clone URL: git://github.com/ryanlowe/acts_as_indestructible.git
name age message
file .gitignore Sun May 25 16:51:02 -0700 2008 add GitHub gemspec file [ryanlowe]
file CHANGELOG Loading commit data...
file MIT-LICENSE Thu May 22 00:25:40 -0700 2008 terminology: use destroyed everywhere instead o... [ryanlowe]
file README Sun May 25 16:51:02 -0700 2008 add GitHub gemspec file [ryanlowe]
file Rakefile Thu May 01 20:43:09 -0700 2008 add partial Rails skeleton to help with testing [ryanlowe]
file TODO
file acts_as_indestructible.gemspec Mon May 26 10:28:05 -0700 2008 update version to 0.1.1 [ryanlowe]
directory app/ Thu May 15 17:54:19 -0700 2008 require user parameter for destroy and destroy_... [ryanlowe]
directory config/ Thu May 01 20:43:09 -0700 2008 add partial Rails skeleton to help with testing [ryanlowe]
directory db/ Thu May 22 00:25:40 -0700 2008 terminology: use destroyed everywhere instead o... [ryanlowe]
file init.rb Fri May 23 19:28:38 -0700 2008 support find by id [ryanlowe]
directory lib/ Fri May 23 19:42:44 -0700 2008 divide the unit tests into subdirectories [ryanlowe]
directory script/ Thu May 01 20:43:09 -0700 2008 add partial Rails skeleton to help with testing [ryanlowe]
directory test/
README
IMPORTANT: This plugin is a work in progress and should not be used in production
yet.  Feel free to fork on GitHub and send patches.

If you would like to see your patch in this Git repository it must be tested.
If you find a bug, a test exposing the bug would be great.

= acts_as_indestructible

  acts_as_indestructible aims to be an alternate version
  of the acts_as_paranoid plugin idea, which is to mark ActiveRecord objects
  as destroyed instead of actually deleting them from the database.
  
  After an object is marked as destroyed it should be excluded from
  all of the ActiveRecord method calls and act as if it
  was deleted from the database.
  
= Differences from acts_as_paranoid

  1. acts_as_indestructible fills the destroyed_at field as well
     as destroyed_by

  2. destroy() and destroy_all(conditions=nil) have a
     user parameter, making them destroy(user) and
     destroy_all(user,conditions=nil).  The user
     parameter is an ActiveRecord user object and
     the user.id is stored in the destroyed_by column.
  
  3. acts_as_paranoid overrides protected and private
     ActiveRecord::Base methods which could change at any time.
     acts_as_indestructible will work to provide the
     same function while using the public API contract that
     will not change within major Rails versions.
    
  4. delete() and delete_all() throw exceptions and are effectively
     deprecated, which prevents developers from permanently deleting
     objects this way.  Raw SQL could still delete objects permanently.
     
     
= API changes from ActiveRecord::Base

  destroy(user)
  destroy_all(user, conditions = nil)
  
  exists?(id_or_conditions, options = {})
  
  DEPRECATED:
  
    ActiveRecord::Base.delete(id)
    ActiveRecord::Base.delete_all
    
     
= Major plugin goals

  - test all corner cases of the ActiveRecord methods affected by this plugin
  - not impact performance, when possible
  - play well with other major plugins
  
  Also see TODO for specific things left to do