I have a module with some class methods I'd like to make available to classes within the module. However, what I'm doing is not working.
module Foo
class << self
def test
# this method should be available to subclasses of module Foo
# this method should be able to reference subclass constants and methods
p 'test'
end
end
end
class Foo::Bar
extend Foo
end
This fails:
Foo::Bar.test
NoMethodError: undefined method `test'
What am I doing wrong?
NameError: uninitialized constant Foo::Bar::ActivityCreator- is there a class definition missing from your example code?