attr_accessor does not work on the following code. The error says \"undefined method \'things\' for Parent:Class (NoMethodError)\":
attr_accessor
undefined method \'things\' for Parent:Class (NoMethodError)
This is probably the simplest way.
class Parent def self.things @@things ||= [] end end Parent.things << :car p Parent.things