Mark Chadwick on 14 Feb 2007 19:27:41 -0000

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PhillyOnRails] Looking for help overriding clear_old_version in acts_as_versioned


I could be mistaken, but I believe acts_as_paranoid will just set the deleted column to true for a "deleted" row.  You could just emulate the AAP behavior, and instead of deleting, just do:

my_model_instance.deleted = true

Then, AAR won't really care what happened (unless you're revisioning the deleted column), and it should stay out of your way, as AAP is going to filter it out of queries.


On 2/14/07, Mike Zornek <> wrote:
For a new rails app I'd like to utilize a combination of acts_as_versioned
and acts_as_paranoid to allow me to track the lifespan of objects (a real
client need).

So far it's working fairly well except that when I destroy an Active Record
object the acts_as_versioned plugin is deleting all of the old versions.
It's using a method called clear_old_version and in the docs it says:

> Clears old revisions if a limit is set with the :limit option in
> acts_as_versioned. Override this method to set your own criteria for clearing
> old versions.

My question is: How do I override it. I added a method to my Active Record
model but I don't think it's getting called. Perhaps it's because this
clear_old_version is buried in a stack of Modules.

Any help is appreciated. Thanks.

~ Mike

To unsubscribe or change your settings, visit:

To unsubscribe or change your settings, visit: