Maybe I’m looking at this the wrong way and with that - hopefully
someone can either suggest a simpler way or the right way.
I have a Quote model - for all intents and purposes, just say it has
one attribute :price.
I want to be able to add the following self-referential attributes
(which I think should be under a has_many, through)
Quotes
has_many requotes through… something
When a quote is made it’s attached to a specific job and locked. When
a similar job comes in, I want to take the original quote, duplicate
it and update it to match the specs of the new job; the old quote
still intact and both having a knowledge of their “parent-child”
relationship.
I’ve looked at Ryan B. latest railscast on self referential
relationships but that doesn’t seem to solve the whole problem.
Say I have quote_id 3 which has been requoted 3 different times. I
then go back and requote one of those, say quote #4… (check the
“hopefully understandable” chart below)
quote#3
=quote#4
==quote#7
=quote#5
=quote#6
quote 3 has 3 children and its first child has a child.
now say I delete quote 4… quote 7 doesn’t know who its proverbial
daddy is. and quote 3 doesn’t know it has any grandchildren. in
theory, i’d like 3&7 to link up when the link between them breaks.
any takers on this one?