I have the following code:
class MyClass
def method
foo = MyClass.all
end
end
which results in this error:
NameError (uninitialized constant MyClass::MyClass)
It works fine if I change it to self.all, but the existing code works fine when I deploy to Heroku. It’s only broken on my local system.
This is with a Rails 3.1.1 app and Ruby 1.9.2
Any ideas what’s up?
You shouldn’t have to do that. Assuming
allis a class method and is not an instance method, doHowever, I think what’s causing your problem is that in production, classes are cached. In development, they get reloaded on every request.