IMPORTANT: This plugin is a work in progress and should not be used in production
yet. Feel free to fork on GitHub and send patches.
If you would like to see your patch in this Git repository it must be tested.
If you find a bug, a test exposing the bug would be great.
= acts_as_indestructible
acts_as_indestructible aims to be an alternate version
of the acts_as_paranoid plugin idea, which is to mark ActiveRecord objects
as destroyed instead of actually deleting them from the database.
After an object is marked as destroyed it should be excluded from
all of the ActiveRecord method calls and act as if it
was deleted from the database.
= Differences from acts_as_paranoid
1. acts_as_indestructible fills the destroyed_at field as well
as destroyed_by
2. destroy() and destroy_all(conditions=nil) have a
user parameter, making them destroy(user) and
destroy_all(user,conditions=nil). The user
parameter is an ActiveRecord user object and
the user.id is stored in the destroyed_by column.
3. acts_as_paranoid overrides protected and private
ActiveRecord::Base methods which could change at any time.
acts_as_indestructible will work to provide the
same function while using the public API contract that
will not change within major Rails versions.
4. delete() and delete_all() throw exceptions and are effectively
deprecated, which prevents developers from permanently deleting
objects this way. Raw SQL could still delete objects permanently.
= API changes from ActiveRecord::Base
destroy(user)
destroy_all(user, conditions = nil)
exists?(id_or_conditions, options = {})
DEPRECATED:
ActiveRecord::Base.delete(id)
ActiveRecord::Base.delete_all
= Major plugin goals
- test all corner cases of the ActiveRecord methods affected by this plugin
- not impact performance, when possible
- play well with other major plugins
Also see TODO for specific things left to do
Mark objects as destroyed instead of deleting them from the database for Ruby on Rails ActiveRecord
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
Development
Dependencies
Runtime
> 2.0.0
Project Readme