This is a patch for issue #2820 ("ActiveRecord 3.1 does not restore connection inheritance after establish_connection/remove_connection on a model").
It applies the solution described in that ticket. There is also a change in connection_adapters/abstract/connection_specification.rb to ensure that a nil pool can't leak out and cause NoMethodErrors.
This pull request is against 3-1-stable. I've verified that the patch also works on master.
Completely remove the pool when removing a connection. Fixes #2820.