public
Description: Rails Plugin - soft-delete your ActiveRecord records. It's like an explicit version of ActsAsParanoid
Homepage: http://6brand.com
Clone URL: git://github.com/JackDanger/permanent_records.git
JackDanger (author)
Sun Sep 27 00:08:13 -0700 2009
commit  754a1b12006a8236879f99cfde9e72724b55573e
tree    df2aa76cab8f3c0dfbc547180e132ed93b57deeb
parent  61cc54c75b0c9cf3e44e83a1ea864532d298fc78
name age message
file MIT-LICENSE Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin gi... [studioda]
file Manifest.txt Thu Mar 19 13:05:40 -0700 2009 Adding Manifest [JackDanger]
file README Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin gi... [studioda]
file Rakefile Sat Sep 26 15:56:40 -0700 2009 updating tests to pass on latest gems [JackDanger]
file VERSION Sun Sep 27 00:08:13 -0700 2009 Version bump to 1.0.5 [JackDanger]
file init.rb Sun Sep 27 00:08:03 -0700 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/ Sun Sep 27 00:08:03 -0700 2009 fixing gem loading [JackDanger]
file permanent_records.gemspec Sun Sep 27 00:02:55 -0700 2009 updating gemspec [JackDanger]
directory tasks/ Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin gi... [studioda]
directory test/ Sun Sep 27 00:02:11 -0700 2009 made sure not to try to count datetime as integer [JackDanger]
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