Actions
Bug #7934
closedAutoloading of Nic models does not work in some cases
Description
Sometimes when we load inteface classes in wrong order it results in errors like this
/home/ares/Projekty/Zdrojaky/foreman/app/models/nic/managed.rb:2:in `<module:Nic>': uninitialized constant Nic::Interface (NameError)
The cause is that require_dependency is in base class for all children (any level of depth). So imagine we have C < B and B < A and we use B first. B requires it's parent A so before B is defined, A is defined. A also included require_dependency of C, so before B definition succeeded C had been loaded. But C requires B which file was visited but B is not defined yet which raises uninitialized constant error.
To fix this every class must require_dependency only it's direct children. This way we never jump under leave of inheritance tree that is being loaded. But going from root, we always get all children (to fix STI loading).
Actions