ActsAsVersioned versioning one to many relations


#1

Hi all, an idea to run past anyone who may have done something like it
before

I have a situation where I have something I want to version, single
model
object, thatâ??s fine. ActsAsVersioned will do the business quite nicely
for
that (I havenâ??t played with it, but from reading api docs looks like
itâ??s
just the ticket), however the trick is, I want to version itâ??s child
objects
as well. Thus for arguments sake lets say we have an Order, with line
items.
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
a
major spanner in the has_many / belongs_to relationship, as the line
items
wonâ??t be simply keyed off just the order id, but now the order id and
the
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
anything
similar ? I suspect Iâ??m going to have to write some pretty ugly code to
achieve it…

TIA

Rowan


rowanhick.com