Polymorphic - Results table for Skills and Category/Criteria

Posted 1 month ago by diaglyph

I'm thinking of using polymorphic relationship to store results (from different users) for skills and criteria in an assessment site. Skills are just a list of skills where the user will select a grade for each skill (would work very simply with the polymorphic relationship, and I have no problem setting that one up).

For the criteria, there is an extra level: they are grouped by Category (so there is a category_criteria table that links multiple criteria with categories) eg Documentation category could have Documentation writing criteria, Organisation criteria, etc and then Organisation criteria could also be used again within a different category (this is something that can be set up by the admin, to create these category/criteria pairings).

table: category
   id
   name

table: criteria
   id
   name

table: category_criteria
   id
   category_id
   criteria_id

So a result value would actually be related to a pairing from the category_criteria table. Is this doable with a polymorphic relationship? Or am I better off just having a separate results table just for the category/criteria pairings?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.