public
Description: Rails Plugin - soft-delete your ActiveRecord records with a deleted_at timestamp. This is a much more explicit version of ActsAsParanoid
Homepage: http://6brand.com
Clone URL: git://github.com/JackDanger/permanent_records.git
Andreas Haller (author)
Fri May 16 14:27:43 -0700 2008
commit  3cbb27ff947ba1f8e65dac2a77f6f34af32db818
tree    4e9f13f1bce99c67263350e8947671c6884309a2
parent  2aacafad73ff7641712f2b04404ebf399c87336c
name age message
file MIT-LICENSE Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin [studioda]
file README Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin [studioda]
file Rakefile Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin [studioda]
file init.rb Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin [studioda]
file install.rb Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin [studioda]
directory lib/ Fri May 16 13:14:06 -0700 2008 has_many :dependent => :destroy should work ... [Andreas Haller]
directory tasks/ Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin [studioda]
directory test/ Fri May 16 14:27:43 -0700 2008 renamed test case [Andreas Haller]
file uninstall.rb Thu Jan 31 10:19:07 -0800 2008 initial checkin of permanent_records plugin [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