module Orchestrate::Rails::UserGuide::TheRefTable

The ref table

Orchestrate.io uses refs to identify specific (sets of) immutable values that have been assigned to keys. For details, read this excellent article from the orchestrate.io blog.

To reap the benefits of orchestrate.io's non-destructiveness, orchestrate-rails uses a special-purpose collection (referred to as the ref table), to store the references to all versions of data for all of the collections in the application. The ref table allows the application to “provide end users a way to track and restore old versions, even in the face of destructive edits.” The ref table is updated after each sucessful put_key request. This update uses the ref value itself as the primary key, while the key/value data consists of the collection, key, timestamp and ref values returned from the successful put_key request.

The ref table feature is enabled by adding the following line to <rails-root>/config/application.rb:

Orchestrate::Application::RefTable.enable

This will create a new collection in the application named orchio_ref_table. Should this name cause a conflict within the application, it can be overridden by specifying the name in the enable call:

Orchestrate::Application::RefTable.enable "my_ref_table_collection_name"

Next

Back to the beginning…