Skip to content

phene/delete_paranoid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

delete_paranoid

Soft Delete ActiveRecord instances.

Usage

class Blog < ActiveRecord::Base
  acts_as_paranoid
end
blog = Blog.create! :name => 'foo'

# soft delete the instance
blog.destroy

# query database for results *including* soft deleted objects
Blog.with_deleted do
  Blog.all
end

# permenantly delete the instance from the database
Blog.delete! blog.id

Features

  • simple configuration

  • preserves existing ActiveRecord API and triggers appropriate callbacks. No magical new API’s to use when you want to soft delete a record

  • automatically exclude soft deleted records from database queries (by default)

  • support for querying database for all records (including soft deleted ones)

  • support for permenantly deleting record from database, including dependent-destroy associations

Contributing

  • Fork the project

  • Fix the issue

  • Submit a pull request on github

Patch acceptance criteria

  • tests must be included

Copyright © 2011 Ryan Sonnek. See LICENSE.txt for further details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%