Skip to content

Commit

Permalink
Small fix so ActiveRecord::Base.connection.tables works with odbc/sql…
Browse files Browse the repository at this point in the history
…server

Without the patch, ActiveRecord::Base.connection.tables returns []
  • Loading branch information
Gaizka committed Feb 25, 2009
1 parent f231ed3 commit 6d7faaf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/active_record/connection_adapters/odbc_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,15 @@ def tables(name = nil)
tblType = row[3]
next if respond_to?("table_filter") && table_filter(schemaName, tblName, tblType)
if @@dbmsLookups.get_info(@dbmsName, @dbmsMajorVer, :supports_schema_names)
tblNames << activeRecIdentCase(tblName) if schemaName.casecmp(currentUser) == 0
if currentUser.nil? || currentUser.blank?
# Cannot check schemaName against currentUser.
# Let's check by tblType
if tblType == "TABLE"
tblNames << activeRecIdentCase(tblName)
end
elsif schemaName.casecmp(currentUser) == 0
tblNames << activeRecIdentCase(tblName)
end
else
tblNames << activeRecIdentCase(tblName)
end
Expand Down

0 comments on commit 6d7faaf

Please sign in to comment.