Skip to content
This repository
tree: 00400aab3e
Fetching contributors…

Cannot retrieve contributors at this time

file 68 lines (47 sloc) 1.435 kb


Don't delete your records, move them to a different table. Like acts_as_paranoid, but doesn't change all your SQL queries.



script/plugin install git://


# terminal
sudo gem install winton-acts_as_archive

# environment.rb
config.gem "winton-acts_as_archive"


Add acts_as_archive to your models:

class Article 

That's it!

Next time your Rails instance boots up, the plugin replicates your table's structure into archived_articles (as per the example), with an additional deleted_at column.

Use destroy, delete, and delete_all like you normally would. Records are copied into the archive table before being destroyed.

Archive Model

Run finds on the archive by adding ::Archive to your model:



Use restore_all to copy archive records back to your table:

Article.restore_all([ 'id = ?', 1 ])

Auto-migrate from acts_as_paranoid

If a deleted_at column is present in your table, the plugin will attempt to move deleted records to the archive table.

Something went wrong with that request. Please try again.