- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1
Seamless archiving capabilities for any model.
License
KellyMahan/acts_as_archive
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
ActsAsArchive ============ I'm working on an acts_as_archive plugin. If you think you could use this or a slight modification to this let me know. I will be using it to archive post data to help load on forums, but still have an easy way to find the archived data. this is still very much a beta plugin that i first started coding on July 10th. This plugin requires the use of http://tangofoxtrot.com/2008/5/8/active-record-save-without-callbacks-plugin currently to use it you would add acts_as_archive to the model you want to have archive abilities. Then add a migration file like this class AddPostCommentArchiving < ActiveRecord::Migration def self.up transaction do Post.create_archive_table Comment.create_archive_table Article.create_archive_table Forum.create_archive_table end end def self.down transaction do Post.drop_archive_table Comment.drop_archive_table Article.drop_archive_table Forum.drop_archive_table end end end this plugin gives you 3 main methods modelinstance.archive Model.unarchive(id) Model.find_archive(args) find_archive: very similar to the regular find. Except it searches the model plus the archived data It accepts :all or :first as the first value :conditions (currently only 1 string; working on using the safe array format) :order :limit :offset it also accepts id's archive: removes the item with a delete call so callbacks aren't made. It also finds all associated models with a dependent destroy or dependent delete and archives them as well if the model is also set as acts as archive. unarchive: adds the item back with it's original data id included. It also finds any associated models that are archived based on the primary key association. TODO make standard finds by ID search the archives as well, I may not include this in the plugin, but code separately. allow for safe conditions in find using array format Copyright (c) 2008 Kelly Mahan, released under the MIT license
About
Seamless archiving capabilities for any model.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
              Packages 0
        No packages published