Single table inheritance problem

I am having trouble getting a single table inheritance to work. This is
what I tried I made a base model called Product, made the migration with
all columns for every type of product that I want to create. Also in my
migration I made a column called type to differentiate between classes.
Also, from what I read in AWD I put the :force -> true option after the
table name.
So now I ran the rake db migrate and it made the table. Then I made a
class called DealProduct and I put it in the models folder as
deal_product.rb. I also made it inherit the base class Product. So I
had:

DealProduct < Product
end

So then I made a controller called deal_product, and then I tried
generating the scaffolding for the controller and the DealProduct
controller, and it throws an error saying “Before updating scaffolding
from new DB schema, try creating a table for your model (DealProduct),”
but if I have it inherited from my base class Product, why is it
throwing me this error, shouldn’t it know that it already has one? And
am I even doing this right, is there anything that would make this not
work?

OOOOO, I got it, so I wasn’t generating the model first, I was just
creating a new class. So what I did was generate the model, then in the
model I put self.inheritance_column = ‘type’ (don;t know if I needed
this, but I saw it in the rails API), and then I ran rake db:migrate
again to create the table. Now I generated the scaffolding for the
controller and model and it worked !!! :slight_smile:

But if anyone could tell me if I need that self.inheritance_column
declaration in my child classes that would be great.