Adam Bloom
2006-Apr-14 15:58 UTC
[Rails] 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 -- Posted via http://www.ruby-forum.com/.