Class: RailsDbBrowser::ConnectionKeeper

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_db_browser/connection_keeper.rb

Overview

Abstract class holding connection staff

Defined Under Namespace

Classes: Column, Connection, FakeModel, Result

Instance Method Summary collapse

Instance Method Details

#connection(name = nil) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/rails_db_browser/connection_keeper.rb', line 9

def connection(name=nil)
  underlying = unless name.present?
    ActiveRecord::Base.connection
  else
    FakeModel.get_connection(name)
  end
  Connection.new(underlying)
end

#connection_namesObject

get connection names



5
6
7
# File 'lib/rails_db_browser/connection_keeper.rb', line 5

def connection_names
  ActiveRecord::Base.configurations.keys
end