Skip to content

Commit 956ce71

Browse files
author
Jippe Holwerda
committed
Explicitly check if the connection of the table engine is the sql server adapter. Fixes #450.
1 parent def93e4 commit 956ce71

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/arel/visitors/sqlserver.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ def visit_Arel_Nodes_SelectStatement o, collector
7474
end
7575

7676
def visit_Arel_Table o, collector
77-
table_name = if o.engine.connection.database_prefix_remote_server?
77+
# Apparently, o.engine.connection can actually be a different adapter
78+
# than sqlserver. Can be removed if fixed in ActiveRecord. See:
79+
# github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/450
80+
table_name = if o.engine.connection.respond_to?(:sqlserver?) and o.engine.connection.database_prefix_remote_server?
7881
remote_server_table_name(o)
7982
else
8083
quote_table_name(o.name)

0 commit comments

Comments
 (0)