From: "Jan E." Date: 2012-10-04T22:44:03+09:00 Subject: Re: Unable to work with class variable Hi, Calling attr_accessor defines getters and setter for the *instances* of the class, not the class itself. I'm also pretty sure that you want in an class instance variable and not a class variable. Then you can simply call attr_accessor in the singleton class of Test: class Test @fields = 'ok' class << self attr_accessor :fields end end p Test.fields If you actually do want a class variable (and know what you're doing), you have to define the getters and setters by hand. There's is no ready-made method for this: class Test @@fields = 'ok' def self.fields @@fields end end p Test.fields -- Posted via http://www.ruby-forum.com/.