Need help modeling complex entity relationships

zenshade-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-11-23T00:42:11Z

I''m attempting to create a simple web app that will allow users to do
sentence completion exercises.  We have users, stems (first part of
sentences to be completed), stem-sets (a particular subset/collection
of stems), and stem responses.  It looks like the primary
entities/tables/associations that I need are:

USERS
has_and_belongs_to_many STEM_SETS

STEMS
has_and_belongs_to_many STEM_SETS

STEM_SETS
has_and_belongs_to_many USERS
has_and_belongs_to_many STEMS

STEM_RESPONSES
??

Not sure about which relationships the stem responses model should
have.  It seems like they should belong to the combination of USERS,
STEMS and STEM_SETS.

If I were just creating the db table for this, I would have:

STEM_RESPONSES
id
user_id
stem_set_id
stem_id
text

Is there a way to represent this with Rails relationships?  Or am I
missing a much easier way to do this?


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---