diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb index 5e70930a85..5ef200fd97 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb @@ -68,7 +68,7 @@ module ActiveRecord raise AdapterNotSpecified unless defined? RAILS_ENV establish_connection(RAILS_ENV) when ConnectionSpecification - @@defined_connections[self] = spec + @@defined_connections[name] = spec when Symbol, String if configuration = configurations[spec.to_s] establish_connection(configuration) @@ -101,11 +101,11 @@ module ActiveRecord klass = self ar_super = ActiveRecord::Base.superclass until klass == ar_super - if conn = active_connections[klass] + if conn = active_connections[klass.name] # Validate the active connection before returning it. conn.verify! return conn - elsif conn = @@defined_connections[klass] + elsif conn = @@defined_connections[klass.name] # Activate this connection specification. klass.connection = conn return self.connection @@ -119,7 +119,7 @@ module ActiveRecord def self.connected? klass = self until klass == ActiveRecord::Base.superclass - if active_connections[klass] + if active_connections[klass.name] return true else klass = klass.superclass @@ -133,9 +133,9 @@ module ActiveRecord # can be used as argument for establish_connection, for easy # re-establishing of the connection. def self.remove_connection(klass=self) - conn = @@defined_connections[klass] - @@defined_connections.delete(klass) - active_connections[klass] = nil + conn = @@defined_connections[klass.name] + @@defined_connections.delete(klass.name) + active_connections[klass.name] = nil @connection = nil conn.config if conn end @@ -143,7 +143,7 @@ module ActiveRecord # Set the connection for the class. def self.connection=(spec) if spec.kind_of?(ActiveRecord::ConnectionAdapters::AbstractAdapter) - active_connections[self] = spec + active_connections[name] = spec elsif spec.kind_of?(ConnectionSpecification) self.connection = self.send(spec.adapter_method, spec.config) elsif spec.nil? |