lib/mongo_mapper/connection.rb in mongo_mapper-0.10.1 vs lib/mongo_mapper/connection.rb in mongo_mapper-0.11.0
- old
+ new
@@ -60,9 +60,13 @@
def connect(environment, options={})
raise 'Set config before connecting. MongoMapper.config = {...}' if config.blank?
env = config_for_environment(environment)
+ if env['options'].is_a? Hash
+ options = env['options'].symbolize_keys.merge(options)
+ end
+
MongoMapper.connection = if env['hosts']
Mongo::ReplSetConnection.new( *env['hosts'].push(options) )
else
Mongo::Connection.new(env['host'], env['port'], options)
end
\ No newline at end of file