kellymahan / acts_as_archive Goto Github PK
View Code? Open in Web Editor NEWSeamless archiving capabilities for any model.
License: MIT License
Seamless archiving capabilities for any model.
License: MIT License
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.