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.
Adam G. (Guest)
on 2006-03-31 15: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 G.
Adam G. (Guest)
on 2006-03-31 16: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.