diff --git a/lib/extensions/descendant_loader.rb b/lib/extensions/descendant_loader.rb index 242e0fb4a832..488ab2500f03 100644 --- a/lib/extensions/descendant_loader.rb +++ b/lib/extensions/descendant_loader.rb @@ -263,7 +263,7 @@ def scoped_name(name, scopes) module ArDescendantsWithLoader def descendants - unless defined? @loaded_descendants + if Vmdb::Application.instance.initialized? && !defined? @loaded_descendants @loaded_descendants = true DescendantLoader.instance.load_subclasses(self) end @@ -275,7 +275,7 @@ def descendants # https://github.com/rails/rails/commit/8f8aa857e084b76b1120edaa9bb9ce03ba1e6a19 # We need to get in front of it, like we do for descendants. def subclasses - unless defined? @loaded_descendants + if Vmdb::Application.instance.initialized? && !defined? @loaded_descendants @loaded_descendants = true DescendantLoader.instance.load_subclasses(self) end