acts_as_versioned_with_changes

ActiveRecord plugin for versioning your models.

6 years after

h2. 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 %>   

h2. Install:

cd vendor/gems

git clone git://github.com/gordonbisnor/acts_as_versioned_with_changes.git

Add a migration:

<pre>class VersionTable > ActiveRecord::Migration
    def self.up
    Article.create_versioned_table
    end
  def self.down
    Article.drop_versioned_table
  end
end</pre>   

In your model:

<pre>class Article > ActiveRecord::Base

acts_as_versioned_with_changes end

h2. 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.