tchandy/octopus — pull request #66 by matsadler (2012-01-09 17:36:00+00:00)
Title: Fix for proxy when adapter modifies the passed config

In the case of a badly behaving connection adapter that modifies the configuration hash it is given, it is possible for a Octopus::Proxy instance to be initialized with an invalid configuration hash.

Using Octopus in a threaded environment causes a new Octopus::Proxy to be created for each thread (see Octopus::Model#connection_proxy).

A badly behaving adapter may alter the configuration hash passed to it.

As the configuration hash for is memoized and reused an Octopus::Proxy instance will be initialized with an invalid configuration hash in threads subsequent to the first, failing with the error "Please install the adapter: `gem install activerecord--adapter` (cannot load such file -- active_record/connection_adapters/_adapter)" when the "adapter" key can not be found in the hash.

To avoid this happening the config hash is duplicated before handing to the connection adapter.