multiversion

Publication workflow management. Also implements versioning and multi-lingual support.

version loading

Every node contains a field used internally to keep track of which version to load. This field serves as a cache and is stored as json inside the database.

vhash

{
  'r' => {
    'en' => 1000, # publication in 'en'
  },
  'w' => {
    'en' => 1001, # new redaction in 'en'
    'fr' => 1002, # redaction in 'fr'
  }
}

Rule to get version number:

def version_id
  access = can_write? ? vhash['w'] : vhash['r']
  access[visitor.lang] || access[ref_lang] || access.values.first
end