views:

19

answers:

0

Hello. I'm quite new to ActiveRecord and i got handed an old project where the customer want some updates done. It's an event signup system.
The system have the following classes;
Registration (holds address information etc for a registration)
Event (the event to which participants sign up)
Participants (people who've signed up to the event)
EventAddendum (the new class wich is to replace the boolean value mentioned below)

Previously the Event class had a boolean flag which determined if the event had a "follow up day" or not. If it did, the user could select either "conference", "conference + follow up" or just follow up. If it didn't you could only select "conference". Now the customer thought it would be cool if they could add more follow up days to an event.

The project uses ActiveRecord version 1.0.3.0 and now i want to add an EventAddendum class which would represent the "follow up day" and be used as a collection in the Event class. I also want the Participant class to be able to have a collection of EventAddendum objects (through a association table) to point out which "follow up days" a participant selected.

As i said i'm very new to AR and i would very much appreciate help how to map these classes and where to use which cascade type and possible inverse. Everything i've tried so far has kinda failed. I manage to save EventAddendum objects to the Event class, but if i sign up some participants to them and try to remove them they either want to resave it through cascade or remove the whole Participant object (instead of the row in my association table).

This is what i want;
Event objects to hold a collection of EventAddendum objects representing available "follow up days" for the event.
Participation objects to hold a collection of EventAddendum objects representing the "follow up days" the participant signed up for.
When deleting an EventAddendum object from an Event, every row in the association table for Participant and EventAddendum to be deleted (since you cant be signed up to a deleted "follow up day")

Any help would be appreciated.
Best regards and thanks in advance, Ludvig