Skip to content

Commit 7334e44

Browse files
committed
[Rails5] Pass MultipleDbTest with removed connections.
1 parent 50153ab commit 7334e44

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/arel/visitors/sqlserver.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,13 @@ def visit_Arel_Table o, collector
7373
# Apparently, o.engine.connection can actually be a different adapter
7474
# than sqlserver. Can be removed if fixed in ActiveRecord. See:
7575
# github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/450
76-
table_name = if o.class.engine.connection.respond_to?(:sqlserver?) && o.class.engine.connection.database_prefix_remote_server?
77-
remote_server_table_name(o)
78-
else
76+
table_name = begin
77+
if o.class.engine.connection.respond_to?(:sqlserver?) && o.class.engine.connection.database_prefix_remote_server?
78+
remote_server_table_name(o)
79+
else
80+
quote_table_name(o.name)
81+
end
82+
rescue Exception => e
7983
quote_table_name(o.name)
8084
end
8185
if o.table_alias

test/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
default_connection: dblib
21

32
default_connection_info: &default_connection_info
43
adapter: sqlserver

0 commit comments

Comments
 (0)