Skip to content

Commit

Permalink
PAUSED: Use git resume to continue working.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrafanie committed Mar 19, 2024
1 parent cdb773d commit f0715ae
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/models/authenticator/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ module Authenticator
class Base
include Vmdb::Logging

# Simulate being a STI table class for proper descendant class loading
def self.inheritance_column
"type"
end

def self.validate_config(_config)
[]
end
Expand Down
14 changes: 12 additions & 2 deletions config/initializers/zeitwerk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,25 @@
Rails.autoloaders.main.collapse(Rails.root.join("lib/ansible/runner/credential"))
Rails.autoloaders.main.collapse(Rails.root.join("lib/pdf_generator"))

excluded_from_eager_load = %w[
ApplicationRecord
MiqDecorator
OrchestrationStack::Status
ResourcePool
]

DescendantLoader.instance.discovered_parent_child_classes.each do |parent, children|
next if excluded_from_eager_load.include?(parent)

puts "Registering on_load for class: #{parent}"
Rails.autoloaders.main.on_load(parent.to_s) do |klass, _abspath|
puts "Running on_load for class: #{klass} with children: #{children}"
children.each do |child|
begin
child.safe_constantize
rescue NameError
puts "!!! FAILED to load #{child} for parent: #{klass}"
rescue NameError => err
puts "!!! FAILED to load #{child} for parent: #{klass} with inheritance column: #{klass.try(:inheritance_column)} reason: #{err}. Error class: #{err.class.name}"
raise
end
end
end
Expand Down
Empty file removed data/git_repos/locks/.gitkeep
Empty file.
5 changes: 5 additions & 0 deletions lib/acts_as_ar_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def self.includes_to_references(_inc)
[]
end

# Simulate being a STI table class for proper descendant class loading
def self.inheritance_column
"type"
end

class << self; alias_method :base_model, :base_class; end

#
Expand Down

0 comments on commit f0715ae

Please sign in to comment.