Created
July 22, 2020 10:29
-
-
Save adamruzicka/066e3f484648c5d5d36d0955fd96ca9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 81cb056aaa972a0c1ad9a49b7c4887d0df8111d6 Mon Sep 17 00:00:00 2001 | |
From: Adam Ruzicka <[email protected]> | |
Date: Wed, 22 Jul 2020 12:26:17 +0200 | |
Subject: [PATCH] Workaround undefined method singleton_class? error | |
NoMethodError: undefined method `singleton_class?' for #<Class:0x0000556b7d6b69b0> | |
/tmp/foreman/app/models/operatingsystem.rb:91:in `<class:Jail>' | |
/tmp/foreman/app/models/operatingsystem.rb:90:in `<class:Operatingsystem>' | |
/tmp/foreman/app/models/operatingsystem.rb:4:in `<main>' | |
/tmp/foreman/app/models/concerns/audit_search.rb:82:in `block in audited_classes_without_sti' | |
/tmp/foreman/app/models/concerns/audit_search.rb:81:in `reject' | |
/tmp/foreman/app/models/concerns/audit_search.rb:81:in `audited_classes_without_sti' | |
/tmp/foreman/app/models/concerns/audit_search.rb:51:in `auditable_type_complete_values' | |
/tmp/foreman/app/models/concerns/audit_search.rb:24:in `block in <module:AuditSearch>' | |
/tmp/foreman/config/application.rb:365:in `include' | |
/tmp/foreman/config/application.rb:365:in `setup_auditing' | |
/tmp/foreman/config/application.rb:339:in `block in <class:Application>' | |
/tmp/foreman/config/environment.rb:5:in `<main>' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors' | |
/home/aruzicka/.gem/ruby/2.6.0/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>' | |
/home/aruzicka/.rbenv/versions/2.6.3/bin/bundle:23:in `load' | |
/home/aruzicka/.rbenv/versions/2.6.3/bin/bundle:23:in `<main>' | |
Tasks: TOP => db:drop => db:load_config => environment | |
(See full trace by running task with --trace) | |
--- | |
lib/zeitwerk/explicit_namespace.rb | 6 +++++- | |
1 file changed, 5 insertions(+), 1 deletion(-) | |
diff --git lib/zeitwerk/explicit_namespace.rb lib/zeitwerk/explicit_namespace.rb | |
index 2d4f015..2a0d755 100644 | |
--- lib/zeitwerk/explicit_namespace.rb | |
+++ lib/zeitwerk/explicit_namespace.rb | |
@@ -59,7 +59,11 @@ module Zeitwerk | |
# If the class is a singleton class, we won't do anything with it so we | |
# can bail out immediately. This is several orders of magnitude faster | |
# than accessing its name. | |
- return if event.self.singleton_class? | |
+ begin | |
+ return if event.self.singleton_class? | |
+ rescue NoMethodError | |
+ puts "FIXME" | |
+ end | |
# Note that it makes sense to compute the hash code unconditionally, | |
# because the trace point is disabled if cpaths is empty. | |
-- | |
2.25.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment