Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

elektronaut/revisionist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Revisionist

Simple Rails plugin for handling revisioning of attributes.

Work in progress.

Installation:

You can install the plugin from github:

script/plugin install git://github.com/elektronaut/revisionist.git

Once the plugin is installed, you need to run the generator to create the Revision model:

script/generate revisionist model
rake db:migrate

Usage:

First, you’ll need to declare the revisionable attributes:

class Company < ActiveRecord::Base
  revisionable :name, :phone
end

Everything else should be automatic:

@company = Company.create(:name => 'My company', :phone => '12345678')
@company.update_attributes(:name => 'New name')
@company.revisions_on?(:name) # => true
@company.revisions_on?(:phone) # => false
@company.revisions_on(:name).first.old_value # => 'My company'

:revisionist and/or :revision_info allows you to maintain some sort of paper trail:

@company.update_attributes(:name => 'My new name', :revisionist => @user)
@company.update_attributes(:name => 'My company', :revision_info => 'Synced against the original source')

About

Simple Rails plugin for handling revisioning of attributes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages