I wanted to know if it is possible to have STI where the subclasses each relate to an unrelated model in different ways.
In other words, say B < A
and C < A
, and I implement single table inheritance on table A
(e.g. a type column where you can have B
or C
to indicate a subclass).
Now let's say we have a separate model called Xyzzy
.
Is it possible to implement a has_and_belongs_to_many
relationship between C
and Xyzzy
while implementing a has_one
relationship between B
and Xyzzy
?
How should I do this in the context of STI? Or would STI simply not affect this?