From: Robert Klemme Date: 2005-04-21T23:14:32+09:00 Subject: Re: accessor for Class Variable "Leonardo Francalanci" schrieb im Newsbeitrag news:4267B13A.20905@simtel.it... > I know it's a stupid question, but I can't find the answer... > > Isn't there another way to have an accessor for a class variable than a > "def"??? Something like "attr_reader"? Not AFAIK. > class Outing < ActiveRecord::Base > @@planingList = [ "YES", "NO", "YES/NO"] > > def Outing.wind_directionList > return @@wind_directions > end > end In your case you could as well do class Outing < ActiveRecord::Base @planingList = [ "YES", "NO", "YES/NO"] class<> Outing.planingList => ["YES", "NO", "YES/NO"] Class variables are really only useful if you want to access them from instances and from the class in a similar way (via "@@var_name"). Otherwise they have more drawbacks than pros so I avoid to use them whenever I can. (Can't really remember a case where I actually needed them.) Kind regards robert