I am having an issue with namespaces in Rails 3.1. I have a class, let's call it a.
#/app/models/a.rb
class a
#some methods
def self.method_from_a
#does things
end
end
But I also have another class that has the same name in a different namespace.
#/app/models/b/a.rb
class b::a
def method
return a.method_from_a
end
end
When I call b::a.method though I get:
NameError: uninitialized constant b::a::a
I am sure it is a simple solution, I am just missing it.
Prefix
a
with::
:This, (i.e. the scope operator) is also explained here:
By the way, in Ruby class names should start with an upper case letter.