If I define an attr_accessor in my model, can I somehow get Vestal
Versions to track changes to the value of these? I’m specifically trying
to get these “synthetic” object properties to be stored in the version
diff, along with the regular column-backed properties.
Has anyone done anything like this? Any tips to offer?
Thanks in advance,
Walter
Walter D. wrote in post #974734:
If I define an attr_accessor in my model, can I somehow get Vestal
Versions to track changes to the value of these? I’m specifically trying
to get these “synthetic” object properties to be stored in the version
diff, along with the regular column-backed properties.
That sounds insane. If a property is worth tracking, isn’t it worth
storing in the database?
Can you give an example of one of these properties?
Has anyone done anything like this? Any tips to offer?
Thanks in advance,
Walter
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
On Jan 13, 2011, at 3:08 PM, Marnen Laibow-Koser wrote:
Versions to track changes to the value of these? I’m specifically
trying
to get these “synthetic” object properties to be stored in the
version
diff, along with the regular column-backed properties.
That sounds insane. If a property is worth tracking, isn’t it worth
storing in the database?
Can you give an example of one of these properties?
Sure. I have an Approval, which is a sort of loosely-coupled join
model between a Role and an Ad. Ads are versioned, and each time I
make a new version of an Ad (to update the artwork or similar) I need
to store the current graph of approvals for historical purposes only.
(Who had approved it already, who hadn’t.)
I allow the users to step back through time to see the evolution of an
ad, and I need to show where it stood at each point. But changing the
approvals doesn’t update the version of an ad, only updating the
artwork does. So I was thinking that I could record the current state
– as a snapshot – just before I saved the version and then play it
back whenever the version did not equal the last version.
Is there a simpler way to do this? I have already wasted a lot of time
trying to version associated records in VV, and it’s made me very
cranky.
Walter
On Jan 13, 2011, at 4:20 PM, Marnen Laibow-Koser wrote:
I allow the users to step back through time to see the evolution of
an
ad, and I need to show where it stood at each point. But changing the
approvals doesn’t update the version of an ad, only updating the
artwork does.
So do you need to show the user different Approvals for one version of
an Ad?
Each time I save a new version of an Ad, I completely reset all of the
approvals. The last version was approved, but this is a new
version, and it might have regressed in someone’s opinion. So the
current association says that nothing is approved immediately after
updating the ad. But a user might want to look back a few versions,
and see who approved it then. I don’t want this historical data to be
live – able to be changed – I just need it to be stored and played
back in some frozen form.
So I was thinking that I could record the current state
– as a snapshot – just before I saved the version and then play it
back whenever the version did not equal the last version.
Is there a simpler way to do this?
Almost certainly. You sound like you’re trying to add complexity when
you could just be working through the object graph and associations.
The associations are always current – they relate only the the most
recent version of the ad. Once I step backward in the Ad’s version
trail, they are no longer accurate.
I have already wasted a lot of time
trying to version associated records in VV, and it’s made me very
cranky.
I don’t know if VV does association versions, but there are other gems
that do – I seem to recall that acts_as_revisable is one.
I’ve tried a bunch of other gems that purported to do this, not sure
if this was one I tried. I’ll give it a look, though. Without some way
to stick the approvals into the versioned Ad model, I’m back where I
started with a set of approvals that don’t track the version.
Walter
Walter D. wrote in post #974750:
On Jan 13, 2011, at 3:08 PM, Marnen Laibow-Koser wrote:
Versions to track changes to the value of these? I’m specifically
trying
to get these “synthetic” object properties to be stored in the
version
diff, along with the regular column-backed properties.
That sounds insane. If a property is worth tracking, isn’t it worth
storing in the database?
Can you give an example of one of these properties?
Sure. I have an Approval, which is a sort of loosely-coupled join
model between a Role and an Ad. Ads are versioned, and each time I
make a new version of an Ad (to update the artwork or similar) I need
to store the current graph of approvals for historical purposes only.
(Who had approved it already, who hadn’t.)
I allow the users to step back through time to see the evolution of an
ad, and I need to show where it stood at each point. But changing the
approvals doesn’t update the version of an ad, only updating the
artwork does.
So do you need to show the user different Approvals for one version of
an Ad?
So I was thinking that I could record the current state
– as a snapshot – just before I saved the version and then play it
back whenever the version did not equal the last version.
Is there a simpler way to do this?
Almost certainly. You sound like you’re trying to add complexity when
you could just be working through the object graph and associations.
I have already wasted a lot of time
trying to version associated records in VV, and it’s made me very
cranky.
I don’t know if VV does association versions, but there are other gems
that do – I seem to recall that acts_as_revisable is one.
Walter
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]