forked from bterkuile/delete_softly
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
DeleteSoftly | ||
============ | ||
|
||
Introduction goes here. | ||
|
||
Add soft delete functionality to ActiveRecord models | ||
|
||
Example | ||
======= | ||
class Post | ||
delete_softly | ||
end | ||
|
||
Example goes here. | ||
class Comment | ||
delete_softly false | ||
end | ||
|
||
Now the following stuff works: | ||
p1 = Post.create | ||
p2 = Post.create | ||
Post.count #=> 2 | ||
p2.destroy | ||
Post.count #=> 1 | ||
Post.at(1.year.ago).count #=> 0 | ||
|
||
c1 = Comment.create | ||
c2 = Comment.create | ||
Comment.count #=> 2 | ||
c1.destroy | ||
Comment.count #=> 2 (Since we added false) | ||
Comment.active.count #=> 1 | ||
|
||
|
||
Copyright (c) 2010 [name of plugin creator], released under the MIT license | ||
Copyright (c) 2010 [Benjamin ter Kuile], released under the MIT license |