# File activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb, line 73 def connection if defined?(@active_connection_name) && (conn = active_connections[@active_connection_name]) conn else # retrieve_connection sets the cache key. conn = retrieve_connection active_connections[@active_connection_name] = conn end end
The MySQL database adapter extends this and allows you to call
to get the current databases name. Useful when you are actively changing the database you are connected to and sometimes need to check the current one.