STI - Polymorphism

Hi everyone,

I’m having some trouble with my models, here’s the case.

I have an Activity table, wich has many Task ( another table), and
then I have a table called Assignment.
Between Assignment and Activity there’s a many-to-many relation, so I
have another table AssignmentActivity

When I want to enter data I start by filling activities, after that I
create a group of tasks for that activity. Lets say that I have create
5 activities and each one has 7 tasks.

Now I create an assignment, and after that I create the activities for
this assignment. Let’s say that I only choose 3 of the 5 activities
and for those 3 activites I only choose 2 tasks of the 7 I had. If
thats the case I’ve made my tables this way

Activity Task

Assignment AssignmentActivity
AssignmentActivityTask

But I realized that the difference between ASSIGNMENTACTIVITY and
ACTIVITY table is only 3 columns, and it happens the same between TASK
and ASSIGNMENTACTIVITYTASK, and I’m not sure if I could use single
table inheritance in this case, or maybe I’m doing it in a wrong way.

Is my approach ok? Hope someone can help me with this

Thanks in advance

Javier Q.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs