Skip to content

Commit

Permalink
Update sqlserver.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanharan committed May 23, 2024
1 parent 57cf215 commit fbdc3c0
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/arel/visitors/sqlserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,9 @@ def visit_Arel_Table(o, collector)
# Apparently, o.engine.connection can actually be a different adapter
# than sqlserver. Can be removed if fixed in ActiveRecord. See:
# github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/450

o.class.engine.with_connection do |connection|
table_name =
begin
table_name =
begin
o.class.engine.with_connection do |connection|
if connection.respond_to?(:sqlserver?) && connection.database_prefix_remote_server?
remote_server_table_name(o)
else
Expand All @@ -139,12 +138,12 @@ def visit_Arel_Table(o, collector)
rescue Exception
quote_table_name(o.name)
end

if o.table_alias
collector << "#{table_name} #{quote_table_name o.table_alias}"
else
collector << table_name
end

if o.table_alias
collector << "#{table_name} #{quote_table_name o.table_alias}"
else
collector << table_name
end
end

Expand Down

0 comments on commit fbdc3c0

Please sign in to comment.