Plugins - Acts As Paranoid

StarAdd to favorites

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.

Rick Olson

http://ar-paranoid.rubyforge.org/

http://svn.techno-weenie.net/projects/plugins/acts_as_paranoid/

Rails' (MIT)

  • Currently 3.3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Model

Tags

Comments

Add a comment
Matt Westcott 9 May 2008

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/

Matt Westcott 28 Apr 2008

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.updateattributes!(self.class.deletedattribute => self.class.send(:current_time)) end freeze end

Eric Pugh 20 Nov 2007

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.

Michael 8 Jul 2007

This overrides find, and is VERY dangerous. Be careful with this plugin.

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?