# Versioning of objects. Best practice?

**URL:** <https://www.ruby-forum.com/t/versioning-of-objects-best-practice/171591>\
**Category:** Rails\
**Created:** [July 6, 2009, 12:32pm UTC](https://www.ruby-forum.com/t/versioning-of-objects-best-practice/171591 "2009-07-06T12:32:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adrian\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cdc98d/32.png) [@Adrian\_D](https://www.ruby-forum.com/u/Adrian_D)\
**Post date:** [July 6, 2009, 12:32pm UTC](https://www.ruby-forum.com/t/versioning-of-objects-best-practice/171591/1 "2009-07-06T12:32:02Z")

</div>

Hi,

I have a model which has a few has\_many associations. I want the user  
let it change (but not delete) including the child objects without  
registration. A big problem is that users could use that for spam etc.  
Therefor I need a system to revert the changes. I found some  
information about it in this group, but I hope there is a better  
approach than it was discussed earlier.

If that is not possible I am looking for a plugin which records all  
changes with a text, so I could recover the former values manually.

Thanks for your help

---

<div class="post-metadata">

**Author:** ![Adrian\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cdc98d/32.png) [@Adrian\_D](https://www.ruby-forum.com/u/Adrian_D)\
**Post date:** [July 6, 2009, 2:13pm UTC](https://www.ruby-forum.com/t/versioning-of-objects-best-practice/171591/2 "2009-07-06T14:13:42Z")

</div>

Adrian D wrote:

> changes with a text, so I could recover the former values manually.  
> Try acts\_as\_versioned[1], I’ve used it before on applications where the  
> users where to be allowed to delete items, but the admin could recover  
> them later.

It creates another table alongside that of the model, and records a new  
row for each change, letting you revert back to any previous version.

HTH

Matt

[1] [http://ar-versioned.rubyforge.org/](http://ar-versioned.rubyforge.org/)

---

<div class="post-metadata">

**Author:** ![Adrian\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cdc98d/32.png) [@Adrian\_D](https://www.ruby-forum.com/u/Adrian_D)\
**Post date:** [July 6, 2009, 3:03pm UTC](https://www.ruby-forum.com/t/versioning-of-objects-best-practice/171591/3 "2009-07-06T15:03:21Z")

</div>

After reading some previous posts about that topic I think  
acts\_as\_versioned is not a solution for models with has\_many  
associations. Do you know whether it got this additional  
functionality?

But I found  
[http://withoutscope.com/2009/5/12/simple-association-versioning-with-acts\_as\_revisable](http://withoutscope.com/2009/5/12/simple-association-versioning-with-acts_as_revisable)  
which looks interesting. I didn’t have enough time to see whether it  
is the right solution for me though.
