Skip to content

Instantly share code, notes, and snippets.

Created October 30, 2014 17:51
Show Gist options
  • Save anonymous/1bf11a3bad139cfceeeb to your computer and use it in GitHub Desktop.
Save anonymous/1bf11a3bad139cfceeeb to your computer and use it in GitHub Desktop.
class Base
class_attribute :my_array
self.my_array = ['some_shared']
end
class Foo < Base
self.my_array << 'some_foo'
end
class Bar < Base
self.my_array << 'some_bar'
end
Foo.my_array #=> ['some_shared', 'some_foo', 'some_bar']
Bar.my_array #=> ['some_shared', 'some_foo', 'some_bar']
but I want
Foo.my_array #=> ['some_shared', 'some_foo']
Bar.my_array #=> ['some_shared', 'some_bar']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment