Class: ActiveRecord::ConnectionAdapters::Sqlserver::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/sqlserver/utils.rb

Class Method Summary collapse

Class Method Details

.unqualify_db_name(table_name) ⇒ Object



16
17
18
19
# File 'lib/active_record/connection_adapters/sqlserver/utils.rb', line 16

def unqualify_db_name(table_name)
  table_names = table_name.to_s.split('.')
  table_names.length == 3 ? table_names.first.tr('[]','') : nil
end

.unqualify_table_name(table_name) ⇒ Object



8
9
10
# File 'lib/active_record/connection_adapters/sqlserver/utils.rb', line 8

def unqualify_table_name(table_name)
  table_name.to_s.split('.').last.tr('[]','')
end

.unqualify_table_schema(table_name) ⇒ Object



12
13
14
# File 'lib/active_record/connection_adapters/sqlserver/utils.rb', line 12

def unqualify_table_schema(table_name)
  table_name.to_s.split('.')[-2].gsub(/[\[\]]/,'') rescue nil
end