Method: Mongoid::Config#load!

Defined in:
lib/mongoid/config.rb

#load!(path, environment = nil) ⇒ Object

Load the settings from a compliant mongoid.yml file. This can be used for easy setup with frameworks other than Rails.

Examples:

Configure Mongoid.

Mongoid.load!("/path/to/mongoid.yml")

Parameters:

  • path (String)

    The path to the file.

  • environment (String | Symbol) (defaults to: nil)

    The environment to load.



327
328
329
330
331
332
333
334
335
# File 'lib/mongoid/config.rb', line 327

def load!(path, environment = nil)
  settings = Environment.load_yaml(path, environment)
  if settings.present?
    Clients.disconnect
    Clients.clear
    load_configuration(settings)
  end
  settings
end