Hello -
I’m writing a rails app that lets people easily put together online
tutorials. Each tutorial is a single webpage, and consists primarily of
an introduction, a series of worked examples and practice questions, and
then finally a summary.
So, what I’m trying to do is classify these examples and practice
questions together, as “segments” belonging to a tutorial, so that I
could easily sort them in a drag-and-drop list, display their titles in
a table of contents, etc. However, I also want the examples and the
practice questions to be kept as separate models, because they’ll be
used separately later on.
I thought that polymorphic associations might be the way to do this, but
the examples I’m finding of it are all for one model being able to
belong to several other models, which is the opposite of what I’m
looking for - I want two or more models to belong to another model in
the same manner, so that they can all easily be handled together.
Should I be looking at polymorphic associations or something else?
Thanks!
Chris