Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files


  • Loading branch information...
commit 00400aab3ea3b0441b2df62ed4336fa84068a2c6 1 parent 98e2d4f
@winton authored
Showing with 58 additions and 13 deletions.
  1. +58 −13 README.markdown
71 README.markdown
@@ -1,23 +1,68 @@
-A gem template for new projects.
+Don't delete your records, move them to a different table.
+Like <code>acts\_as\_paranoid</code>, but doesn't change all your SQL queries.
+script/plugin install git://
-git clone git:// my_project
-cd my_project
-rm -Rf .git
-git init
-git remote add origin
+# terminal
+sudo gem install winton-acts_as_archive
+# environment.rb
+config.gem "winton-acts_as_archive"
-Rename these files/folders:
+Add <code>acts\_as\_archive</code> to your models:
-ls **/acts_as_archive*
+class Article < ActiveRecord::Base
+ acts_as_archive
-Do a project-wide find/replace on <code>acts_as_archive</code>.
+That's it!
+Next time your Rails instance boots up, the plugin replicates your table's structure into
+<code>archived\_articles</code> (as per the example), with an additional <code>deleted\_at</code> column.
+Use <code>destroy</code>, <code>delete</code>, and <code>delete_all</code> like you normally would.
+Records are copied into the archive table before being destroyed.
+Archive Model
+Run finds on the archive by adding <code>::Archive</code> to your model:
+Use <code>restore\_all</code> to copy archive records back to your table:
+Article.restore_all([ 'id = ?', 1 ])
+Auto-migrate from acts\_as\_paranoid
+If a <code>deleted\_at</code> column is present in your table, the plugin will attempt to move deleted
+records to the archive table.
Please sign in to comment.
Something went wrong with that request. Please try again.