new to rails - question about :through and habtm - example

Hey Scott,

I'm new to Rails myself, but hope I can help in some way...

Perhaps a simplification to your model might help. Would it possible
to consider it this way instead:

A person may attend many classes. Additionally, a class may be
attended by many people. When a person attends a class, they are
associated a role.

This simplification prohibits a person from having more than one role
for a particular class. For example, Alan can attend Chemistry as a
student and English as a teacher. But Alan could not attend Chemistry
as a student AND a teacher.

Let me know if this simplification seems viable; if so, I'll see if I
can help you build your models :slight_smile:

Hope this helps.


Hey Scott,

Great. I'm glad you've found a different approach that works!

Yes: I guess my thinking is if the IDs are unique, and the resolution
table (people_classes) contains a primary composed of the two foreign
keys (person_id, class_id), then a single person could not be
duplicated in a class (and vice-versa).

Good luck!

- Louis.