9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/active_record/connection_adapters/mongo_adapter.rb', line 9
def self.mongo_connection(config)
config = config.symbolize_keys
pair_or_host = config[:host] || 'localhost'
port = config[:port] || 27017
database = config[:database]
options = config.dup
[:adapter, :host, :port, :database].each {|i| options.delete(i) }
connection = Mongo::Connection.new(pair_or_host, port, options).db(database)
ConnectionAdapters::MongoAdapter.new(connection, logger, config)
end
|