Active Record: subclassing a model


#1

Hi there,

I have a model

class Account < ActiveRecord::Base
has_many: projects

The accounts table holds company information so as I created another
model to represent project partners thus:

class Partner < Account
has_and_belongs_to_many :projects

#project.account pulls up the project owner and #project.partners pulls
up all partners, including the owner.

Now, this all seems to work fine but every now and then I get the
following error message:

(eval):1:in alias_method': undefined methoddestroy_without_callbacks’
for class `Partner’

…trace…

This error occured while loading the following files:
./script/…/config/…/app/controllers/application.rb
login_system.rb
user.rb
account.rb
project.rb
partner.rb

I can’t figure out how to correct this. Any ideas?

Regards

Adam G.


#2

I’ve just realised that I’ve moronically described single table
inheritance. The problem is still there though…