Forum: Ruby on Rails Removing an association from a derived class

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
pankaj (Guest)
on 2009-01-29 06:42
(Received via mailing list)
I am using single table inheritance.

class User < ActiveRecord::Base
  has_many :abc

class Student < User


The student class should not inherit the has_many :abc relationship.
How can we override it? Is there a way to remove an association in the
derived class?

Thomas r. K. (Guest)
on 2009-01-29 18:49
(Received via mailing list)
Hi Pankaj,

has_many creates quite a few other methods and you could remove them
all but
the usual and easiest way is to ignore and not to use them.
Or, of course, change the design of your models.

ciao, tom
This topic is locked and can not be replied to.