Skip to content

Commit

Permalink
Rescue ActiveRecord::ConnectionNotEstablished errors during
Browse files Browse the repository at this point in the history
`const_get`

Resolves #2004
  • Loading branch information
KaanOzkan committed Dec 6, 2024
1 parent cc54939 commit 54d49a0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/tapioca/runtime/reflection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down

0 comments on commit 54d49a0

Please sign in to comment.