JackDanger / permanent_records

Rails Plugin - soft-delete your ActiveRecord records. It's like an explicit version of ActsAsParanoid

This URL has Read+Write access

name age message
file .document Sat Sep 26 15:59:39 -0700 2009 updating document manifest [JackDanger]
file .gitignore Fri Nov 13 11:57:36 -0800 2009 Ignoring the debug.log. [jqr]
file MIT-LICENSE Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin gi... [studioda]
file README Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin gi... [studioda]
file Rakefile Fri Nov 13 12:02:22 -0800 2009 updating project description [JackDanger]
file VERSION Mon Nov 16 13:19:21 -0800 2009 Version bump to 1.0.6 [JackDanger]
file init.rb Fri Nov 13 11:57:35 -0800 2009 fixing gem loading [JackDanger]
file install.rb Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin gi... [studioda]
directory lib/ Fri Nov 13 11:57:36 -0800 2009 Using conditions as a string to get named_scope... [jqr]
file permanent_records.gemspec Mon Dec 28 17:45:56 -0800 2009 updating auto-generated gemspec [JackDanger]
directory test/ Fri Nov 13 11:57:35 -0800 2009 Forcing table creation so tests on persistent d... [jqr]
file uninstall.rb Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin gi... [studioda]
README
PermanentRecords
================

This plugin prevents any of your records from being destroyed casually.
Any model with a deleted_at datetime column will have that column set rather than being deleted.

Usage
=======

User.find(3).destroy          # sets the 'deleted_at' attribute to Time.now and returns a frozen record
User.find(3).destroy(:force)  # executes the real destroy method, the record will be removed from the database
User.delete_all               # bye bye everything

There are also two named scopes provided for easily searching deleted and not deleted records:

User.send :with_deleted { User.find(:all) }     # only returns deleted records.
User.send :with_not_deleted { User.find(:all) } # you guessed it.

These are named so as to work smoothly with other scoping plugins like scope_out.


Copyright (c) 2008 Jack Danger Canty of adPickles Inc., released under the MIT license