Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ext_active_record/connection_specification.rb

Class Method Summary collapse

Class Method Details

.active_connection_nameObject

:nodoc:



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ext_active_record/connection_specification.rb', line 6

def active_connection_name #:nodoc:
  @active_connection_name ||=
    if active_connections[name] || @@defined_connections[name]
      name
    elsif self == ActiveRecord::Base
      nil
    elsif self.parent_module.ancestors.include?(MagicMultiConnection::Connected)
      self.parent_module.establish_connection_on self
      self.active_connection_name
    else
      superclass.active_connection_name
    end
end