Sha256: ec35014a08570322f8c7d8f7d993d967a582e0029859f18954563e04df4663c9
Contents?: true
Size: 1.01 KB
Versions: 19
Compression:
Stored size: 1.01 KB
Contents
module Mongoid module VersionSetup def self.configure config version = Mongoid::VERSION case when version < '2' raise ArgumentError, "Mongoid versions < 2 not supported" when version < '3' version_2 config when version > '3' version_3 config end end def self.version_3 config require 'moped' config.connect_to('mongoid_geo_test') end def self.version_2 config require 'bson' opts = YAML.load(File.read(File.dirname(__FILE__) + '/support/mongoid.yml'))["test"] opts.delete("slaves") # no slaves support for version < 3 name = opts.delete("database") host = opts.delete("host") port = opts.delete("port") config.master = begin Mongo::Connection.new(host, port, opts).db(name) rescue Mongo::ConnectionFailure Mongo::Connection.new(host, '27017', opts).db(name) end config.logger = nil config.allow_dynamic_fields = true end end end
Version data entries
19 entries across 19 versions & 1 rubygems