Skip to content

culturecode/evolution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Evolution

Installation

In your Gemfile

gem 'evolution', :github => 'culturecode/evolution'

Generate the tables

rails generate evolution:migration

Add the tracking columns to your own tables in a migration

add_column 'my_models', :extinct, :boolean, :default => false
add_column 'my_models', :generation, :integer
add_index 'my_models', :extinct

MyModel.update_all(:extinct => false)
MyModel.update_all(:generation => 1)
MyModel.reset_hierarchy

change_column_null 'my_models', :extinct, false
change_column_null 'my_models', :generation, false

Usage

doc = Document.create
new_doc = doc.evolve
new_doc.generation #=> 2

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •