Class: DbBrowser::ConnectionMan

Inherits:
Object
  • Object
show all
Defined in:
lib/dbbrowser/connection.rb

Overview

connection manager

Defined Under Namespace

Classes: AbstractModel, Column, Connection, Result, Table

Instance Method Summary collapse

Instance Method Details

#connection(key = 'std') ⇒ Object

get connection names

def connection_names
  ActiveRecord::Base.configurations.keys
end


10
11
12
13
14
15
16
17
18
19
# File 'lib/dbbrowser/connection.rb', line 10

def connection( key='std' )
  if key == 'std'
    # -- use/try 'standard/default' connection
    con = ActiveRecord::Base.connection
  else
    con = AbstractModel.connection_for( key )
  end
  # wrap ActiveRecord connection in our own connection class
  Connection.new( con, key )
end