Acts_as_versioned + optimistic locking

Is it possible to use this plugin with version and lock_version
columns?

From my experimentation I can’t get it to work the way I’d hoped.

I have the following User model.

class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :name
t.string :email
t.integer :lock_version, :default => 1
t.integer :version, :default => 1

  t.timestamps
end

end

def self.down
drop_table :users
end
end

class User < ActiveRecord::Base
acts_as_versioned
end

class AddVersioning < ActiveRecord::Migration
def self.up
User.create_versioned_table
end

def self.down
User.drop_versioned_table
end
end

So I create a new user, and the version column is set to one in both
tables. I then edit the user and I would expect the version to be 2 in
the user table and 2 in the user_versions table, but it isn’t, its
still 1.

Using only a lock_version column doesn’t work either. It breaks as
soon as you revert_to! to a previous version and then edit the user
again. The lock_version column in the user_versions table doesn’t
increment correctly so you end up with a non-contiguous lock_version
column which means you can no longer revert to any version of a user
because it now has multiple records for the same version.

Any help or pointers are much apprecaited.

Many thanks