Skip to content

Commit 4e0be28

Browse files
committed
Column reflection on table name rescues LoadError and a few others.
1 parent 9628923 commit 4e0be28

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/active_record/connection_adapters/sqlserver_adapter.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ def table_name
9797
end
9898

9999
def table_klass
100-
@table_klass ||= table_name.classify.constantize rescue nil
100+
@table_klass ||= begin
101+
table_name.classify.constantize
102+
rescue StandardError, NameError, LoadError
103+
nil
104+
end
101105
(@table_klass && @table_klass < ActiveRecord::Base) ? @table_klass : nil
102106
end
103107

0 commit comments

Comments
 (0)