I have a plugin that creates an abstract ActiveRecord class that other
models are to inherit from.
module MyPlugin
class MyClass < ActiveRecord::Base
self.abstract_class = true
# methods
end
end
Then the use of the plugin simply has to do the following to use it’s
functionality:
class Foo < MyPlugin::MyClass
end
The problem is in the development environment. Apparently some systems
are getting a “uninitialized constant MyClass” error after the first
request, but works fine on other systems.
It’s like Rails is wiping out the definition for MyPlugin::MyClass but
never reloads it.
My init.rb simply requires the file and doesn’t do anything tricky with
it that might only be executed at load time.
It DOES WORK however if I rename the class so it’s not in the namespaced
module. Meaning instead of MyPlugin::MyClass, MyPluginMyClass. This
seems to solve the issue, but I really don’t like from a purely semantic
point of view. I really want all the code for this plugin to be inside
this single name spaced module.
Is this a bug in dependency reloading?