I have a class, CustomerRequest, which I have subclassed into three
other classes, all different types of customer requests. I chose to
use polymorphic associations to map the subclasses in my database.
For one of the subclasses, InstallRequest, I have generated a new
model and defined a new table in the generated migration. However,
when I instantiate InstallRequest in the console the only attributes
that appear in the object are those of the superclass,
CustomerRequest. The columns I defined in the subclass’ migration do
not appear as attributes of the object.
-I have verified that the subclass, InstallRequest, is defined as a
subclass of CustomerRequest, not ActiveRecord, in the model file.
-I have verified that the database has been migrated to the latest
Is this expected behavior or is there a bug in my code? I was
expecting the subclass to have all of the attributes of the superclass
as well as those defined in the migration file generated for the
subclass. If this is expected behavior how can I map the columns of
the subclass’ table to the subclass objects?