diff --git a/lib/tapioca/runtime/reflection.rb b/lib/tapioca/runtime/reflection.rb index a17c67883..463e6eea8 100644 --- a/lib/tapioca/runtime/reflection.rb +++ b/lib/tapioca/runtime/reflection.rb @@ -50,6 +50,12 @@ def constantize(symbol, inherit: false, namespace: Object) namespace.const_get(symbol, inherit) rescue NameError, LoadError, RuntimeError, ArgumentError, TypeError UNDEFINED_CONSTANT + rescue => e + if defined?(ActiveRecord) && defined?(ActiveRecord::ConnectionNotEstablished) && e.is_a?(ActiveRecord::ConnectionNotEstablished) + UNDEFINED_CONSTANT + else + raise + end end sig { params(object: BasicObject).returns(T::Class[T.anything]).checked(:never) }