require 'multidb/configuration'
require 'multidb/model_extensions'
require 'multidb/balancer'

module Multidb
  class << self
    
    def install!
      configure!
      if @configuration and not @configuration.raw_configuration[:databases].blank?
        ActiveRecord::Base.class_eval do
          include Multidb::ModelExtensions
        end
        @balancer = Balancer.new(@configuration)
      end
    end
    
    attr_reader :balancer

    delegate :use, :get, :to => :balancer

  end
end

Multidb.install!

require 'multidb/configuration'
require 'multidb/model_extensions'
require 'multidb/balancer'

module Multidb
  class << self
    
    def install!
      configure!
      if @configuration and @configuration.raw_configuration[:databases].any?
        ActiveRecord::Base.class_eval do
          include Multidb::ModelExtensions
        end
        @balancer = Balancer.new(@configuration)
      end
    end
    
    attr_reader :balancer

    delegate :use, :get, :to => :balancer

  end
end

Multidb.install!

--- 
+++ 
@@ -7,7 +7,7 @@
     
     def install!
       configure!
-      if @configuration and @configuration.raw_configuration[:databases].any?
+      if @configuration and not @configuration.raw_configuration[:databases].blank?
         ActiveRecord::Base.class_eval do
           include Multidb::ModelExtensions
         end
Fix nil error when no databases are defined.
