Mike Zornek on 15 Feb 2007 04:25:28 -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 2/14/07 10:10 PM, "Flinn Mueller" <theflinnster@gmail.com> wrote:

> Add this to your config/environment.rb
> <snip>

This is working great.

> Clear old versions only runs after_save, and it's only to prune
> versions in excess of the limit you set.  The reason the old versions
> get deleted is because they are :dependent => :delete_all to the
> original model and get zapped before_destroy.  So the solution is to
> override versioned_class.delete_all.
> 
> With this setup, the versioned record doesn't pick up deleted_at.  My
> guess is (I haven't tested it) if you wanted to revive the record, it
> would be easier to revert to the record without deleted_at than
> revert and clear deleted_at so the record is alive again. Ymmv.

Oh ok. Yeah a misunderstanding on my part. I'll be playing with this some
more, but at first glance seems to be working well for me.

(Now I just need to write a helper that I can pass this class to and get a
reasonable UI of how things changed over time...)

~ Mike
-- 
Work: http://ClickableBliss.com
Play: http://MikeZornek.com


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