Flinn Mueller on 14 Feb 2007 19:36:15 -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


On Feb 14, 2007, at 1:58 PM, Mike Zornek wrote:
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:

Mike,
You might try removing this line in vendor/plugins/acts_as_versioned/lib/acts_as_versioned.rb
:dependent   => :delete_all

Mine is on line 189 ymmv.

Afaik acts_as_paranoid overrides destroy so that instead of destroying the record, it sets a deleted_at.  Without getting too deep my guess is AR is calling the association code:
before_destroy { |record| #{reflection.class_name}.delete_all(%(#{dependent_conditions})) }

So even if acts_as_paranoid overrides the normal behavior of destroy it isn't overriding the before_destroy callback.  That's just a guess, please let me know how you make out, I have a project that needs to use both of these plugins for the exact same purpose, so I'd like to know if that resolves it for you.

--flinn
_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk