From: Andrew Thompson Date: 2006-04-12T00:20:56+09:00 Subject: Re: class variables and inheritance (ActiveRecord problem) Stephen Bannasch wrote: > I'd like to be able to create a class variable that will apply to all > objects made from that class and ALSO create a derived class with a > different class variable that is used in objects created from the > derived class WITHOUT affecting the class variable defined in the > original class. Try a class instance variable vs a class variable: class C @somevar = 'x' class << C def somevar @somevar end def somevar=(var) @somevar=var end end end Its not as easily accessible as a class variable (only accessible from class methods) and you'd have to initialize it to something in derived classes (otherwise it's nil) but its non-inherited. Not totally what you want, but maybe it'll help. Andrew -- Posted via http://www.ruby-forum.com/.