Closed gluxon closed 10 years ago
Nice catch. What should be in the Schedule
model is something like this:
has_many :periods, dependent: :delete
This will make it so that if the parent is destroyed, the children are destroyed with it. The default behavior is for the documents to just be nullified (basically, the $schedule_id
field in the Period
document is just set to null).
The other option is to make the Period
an embedded document. This will make it so that there are Period
documents within the Schedule
document.
If you want to handle this, go right ahead. Otherwise, I can whip something up and send a pull request — remember, you're the leader of this project now, I'm just the spiritual advisor. :sparkles:
So I looked into the database at MongoHQ recently and noticed that the current schema separates periods and schedules. Periods are referenced back to their schedules by a schedule_id field.
This looks fine, but it appears that the clock isn't managing periods as schedules are deleted. There are currently 289 periods and 2 schedules.
Also, was there a technical problem with placing periods inside the schedule structure?