Links
Acts As Paranoid
Categories
Acts As Paranoid
Make your Active Records "paranoid." Deleting them does not delete the row, but set a deleted_at field. Find is overloaded to skip deleted records.
Vitals
| Home | http://ar-paranoid.rubyforge.org/ |
|---|---|
| Repository | http://svn.techno-weenie.net/projects/plugins/acts_as_paranoid/ |
| License | Rails' (MIT) |
| Tags |
no-longer-working
|
| Rating | (28 votes) |
| Owner | Rick Olson |
| Created | 18 May 2006 |
Comments
-
This overrides find, and is VERY dangerous. Be careful with this plugin.
-
Be Aware! If you go to http://ar-paranoid.rubyforge.org/, the README and content are from 2005... You need to instead checkout the version from the repository http://svn.techno-weenie.net/projects/plugins/acts_as_paranoid/
It's the usual thing with open source, the docs are always out of date. In this case, by two years... I haven't downgraded my rating based on this, but it definitly is a warning sign when the docs online are 2 years out of date.
-
This plugin needs patching to work with Rails 2.0.2 (and possibly earlier), as it assumes that calls to 'destroy' will perform the deletion via a call to delete_all, which it doesn't. I patched it by adding the following method to paranoid.rb, after the module InstanceMethods / def self.included(base) declaration:
def destroy unless new_record?
self.update_attributes!(self.class.deleted_attribute => self.class.send(:current_time))end freeze end
-
Sorry, ignore me. It turns out I'd fallen victim to this bug, and misdiagnosed it: http://ar-code.lighthouseapp.com/projects/3108/tickets/8-declaring-acts_as_paranoid-after-a-habtm-association-causes-problems/

