Module: ClosureTree::NumericOrderSupport

Defined in:
lib/closure_tree/numeric_order_support.rb

Defined Under Namespace

Modules: GenericAdapter, MysqlAdapter, PostgreSQLAdapter

Class Method Summary collapse

Class Method Details

.adapter_for_connection(connection) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/closure_tree/numeric_order_support.rb', line 5

def self.adapter_for_connection(connection)
  adapter_name = connection.adapter_name.downcase
  if adapter_name.include?('postgresql') || adapter_name.include?('postgis')
    ::ClosureTree::NumericOrderSupport::PostgreSQLAdapter
  elsif adapter_name.include?('mysql') || adapter_name.include?('trilogy')
    ::ClosureTree::NumericOrderSupport::MysqlAdapter
  else
    ::ClosureTree::NumericOrderSupport::GenericAdapter
  end
end