I'm trying to solve the problem of orphaned records, and wondering what
the best solution is, maybe someone can help me with a little example
I have the following models.
and when someone generates an enquiry they select a course, it all works
so that I can do the following.
Enquiry.course.price_per_week * Enquiry.course_duration
However I have a problem I need to solve.
The administrator should be able to add, update and delete enquiries and
also add, update and delete courses. I know this can cause "orphaning"
problems as if an enquiry exists but the course for that enquiry has
been destroyed the record will be invalid and my application will crash.
I know about several ways to solve this but I'd like opinions on which
is best and how to achieve it.
For the time being I removed the ability of the admin to delete courses
(was thinking of putting in an "archive" boolean to just switch it off),
but then I'll end up with lots of old rubbish in the DB.
Hope this makes sense? bb.