/acts_as_versioned_with_changes

ActiveRecord plugin for versioning your models.

Primary LanguageRubyMIT LicenseMIT

acts_as_versioned_with_changes

Fork of technoweenie’s acts_as_versioned gem. My fork just adds a serialized ‘changes’ column to the versioned table which you can use do show the changes that were made in this version against the original eg:

<% version.changes.each_pair do |key,values| >
Field: <
= key >
Original: <
= values.first >
Updated: <
= value.last >
<
end %>

Install:

  1. cd vendor/gems
  2. git clone git://github.com/gordonbisnor/acts_as_versioned_with_changes.git
  3. Add a migration:
    class VersionTable > ActiveRecord::Migration
    def self.up
    Article.create_versioned_table
    end
    def self.down
    Article.drop_versioned_table
    end
    end
  4. In your model:
    class Article > ActiveRecord::Base
    acts_as_versioned_with_changes
    end

Usage

Same as acts_as_versioned, just adds a serialized changes column if you need a hash to indicate the changes made from one version to the next.