alexstaubo/multidb — pull request #1 by antage (2013-01-28 01:30:23+00:00)
Title: Multidb should be initialized after ActiveRecord in Rails

When I try to use multidb with rails application I got following error:
```
ActiveRecord::ConnectionNotEstablished
/home/antage/workspace/app/.gems/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:167:in `connection_pool'
/home/antage/workspace/app/.gems/ruby/1.9.1/gems/ar-multidb-0.1.6/lib/multidb/configuration.rb:6:in `configure!'
/home/antage/workspace/app/.gems/ruby/1.9.1/gems/ar-multidb-0.1.6/lib/multidb.rb:12:in `install!'
/home/antage/workspace/app/.gems/ruby/1.9.1/gems/ar-multidb-0.1.6/lib/multidb.rb:28:in `'
/home/antage/workspace/app/.gems/ruby/1.9.1/gems/ar-multidb-0.1.6/lib/ar-multidb.rb:1:in `require'
/home/antage/workspace/app/.gems/ruby/1.9.1/gems/ar-multidb-0.1.6/lib/ar-multidb.rb:1:in `'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
/home/antage/workspace/app/config/application.rb:13:in `'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/antage/workspace/app/Rakefile:4:in `'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load_rakefile'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rake/application.rb:501:in `raw_load_rakefile'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rake/application.rb:82:in `block in load_rakefile'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rake/application.rb:81:in `load_rakefile'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rake/application.rb:65:in `block in run'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/home/antage/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rake/application.rb:63:in `run'
/home/antage/.rbenv/versions/1.9.3-p327/bin/rake:32:in `

'
```

It occurs due to multidb trying to get connection_pool before it's initialized.
I added lazy hook to ensure multidb extend activerecord after activerecord's initialized.