Model extends and belongs_to another model - problem

I have a model, categories, and another model, subcategories. In my
current code these have no connection except for the fact that
categories has_many subcategories and a subcategory belongs_to a
category. But by necessity, I need to change it so Subcategory extends
Category; so that I can search both models with one command.

I was hoping it would be as simple as changing Subcategory <
ActiveRecord::Base to Subcategory < Category, but no such luck. Now I
get the error:

no such column “category_id” in categories

when the page tries to run:

<% for subcategory in category %>

What am I missing about inheritance? AWD has very little on the subject.

Thanks,

Adam

Any thoughts?

-Adam

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