Workflow and versioning solution needed using Ruby and ActiveRecord
===

I'm having major problems trying to figure out a way of introduction a solution into an app (using Padrino and ActiveRecord) I'm building that will give me both a workflow on the objects as well as versioning those objects as well. Its made harder that some of the objects have has_many associations which should also be versioned at the same time.

If I had an ActiveRecord object called Article, I know I can control the workflow state using one of the numerous workflow gems available. This would allow me to change it's state from 'draft' to 'needs approving' to 'live'. So far so good.

The problem comes when, say I want to edit a 'live' Article, what to do then?

What I would want to happen is that the current 'live' one would be unaffected and new version is created, with its state going through the same workflow process but once it is set to 'live' it replaces the original Article. 

This wouldn't be so bad if it was a single ActiveRecord object that I could just dup but like I said some of the objects I want to implement this for have other objects associated to them so duplicating a whole object graph seems a bit extreme. 

But then again at the moment I am totally stuck so open to suggestions...

Should also add, I've spent some time looking at versioning gems like [Vestral Versions][1] and [Paper Trail][2], but it seems to be that they want the current version to always be latest one which I don't.

  [1]: https://github.com/laserlemon/vestal_versions
  [2]: https://github.com/airblade/paper_trail