Sha256: 9d938f627ef183427ae1789887cd58c22ceb39a9bf287e14a77aea1bfb944385
Contents?: true
Size: 498 Bytes
Versions: 6
Compression:
Stored size: 498 Bytes
Contents
database_config_file = File.join(Rails.root, "/config/database.mongo.yml") yaml_content = File.read(database_config_file) db_config = YAML::load(yaml_content) if db_config[Rails.env] && db_config[Rails.env]['adapter'] == 'mongodb' mongo = db_config[Rails.env] connection = Mongo::Connection.new(mongo['host']) Mongoid.database = connection.db(mongo["database"]) if mongo["username"] Mongoid.database.authenticate(mongo["username"], mongo["password"]) end end
Version data entries
6 entries across 6 versions & 1 rubygems