Forum: Ruby on Rails ActsAsVersioned versioning one to many relations

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
rowan (Guest)
on 2005-11-22 06:37
(Received via mailing list)
Hi all, an idea to run past anyone who may have done something like it

I have a situation where I have something I want to version, single
object, thatâ??s fine. ActsAsVersioned will do the business quite nicely
that (I havenâ??t played with it, but from reading api docs looks like
just the ticket), however the trick is, I want to version itâ??s child
as well. Thus for arguments sake lets say we have an Order, with line
I want to create a new version of the order each time the line item(s)
change and or the order changes. Now this as I understand it will throw
major spanner in the has_many / belongs_to relationship, as the line
wonâ??t be simply keyed off just the order id, but now the order id and
version  (with all the line items copied/changed on a new
version/causing a
new version).

I havenâ??t done any serious thinking about it yet, but anyone tried
similar ? I suspect Iâ??m going to have to write some pretty ugly code to
achieve it..



This topic is locked and can not be replied to.