forked from ryanlowe/acts_as_indestructible
-
Notifications
You must be signed in to change notification settings - Fork 0
aforward-oss/acts_as_indestructible
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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
About
Mark objects as destroyed instead of deleting them from the database for Ruby on Rails ActiveRecord
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published