Forum: Ruby on Rails Active Record: subclassing a model

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eec43f946d65be32e6b9fd2b3a1582a5?d=identicon&s=25 Adam Groves (addywaddy)
on 2006-03-31 13:37
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 method `destroy_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 Groves
Eec43f946d65be32e6b9fd2b3a1582a5?d=identicon&s=25 Adam Groves (addywaddy)
on 2006-03-31 14:03
I've just realised that I've moronically described single table
inheritance. The problem is still there though...
This topic is locked and can not be replied to.