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
doc = Document.create
new_doc = doc.evolve
new_doc.generation #=> 2