Search code examples
ruby-on-railsactiverecordacts-as-versioned

What's the best way to store the ActiveRecord Models with Versions and their Associations with Versions?


If all I have is one model (for example Wiki) and want to save it along with its versions, I could use acts_as_versioned plugin which stores the wikis in "wikis" table and its versions in "wikis_versions" table. This is plain an simple even if I want to moderate the latest version before showing it to the public using a field as status with "pending review/ published".

What's the best way to handle Wiki with associations (for example attachments, assets,..) which also have versions? And how would you moderate it? Do you create a new version to wiki even though only its association is changed just to keep the flow going, if so what about other associations?

What's the best way to handle it with little db overhead?

Thanks in advance.


Solution

  • I have used both acts_as_versioned and acts_as_audited.

    I prefer the latter because it uses a single table. Using acts_as_versioned we've had issues with changes to versioned tables requiring extra migrations => this adds extra complexity to our build and deployment process.