def connect_to_database(db_settings, force = false)
      # only setup database connection once
      if force
        ActiveRecord::Base.establish_connection(db_settings)
      else
        begin
          ActiveRecord::Base.connection
        rescue => e
          require 'pp'
          pp db_settings
          puts "failed to connect: #{e}"
          ActiveRecord::Base.establish_connection(db_settings)
        end
      end
    end
def connect_to_database(db_settings, force = false)
      # only setup database connection once
      if force
        ActiveRecord::Base.establish_connection(db_settings)
      else
        begin
          ActiveRecord::Base.connection
        rescue => e
          require 'pp'
          pp db_settings
          puts "failed to connect: #{e}"
          ActiveRecord::Base.establish_connection(db_settings)
        end
      end
    end
Connect to databse, example
   mysql_db(:host => "localhost", :database => "lavabuild_local", :user => "root", :password => "")