Module: Mongoid::Config::Validators::Session

Extended by:
Session
Included in:
Session
Defined in:
lib/mongoid/config/validators/session.rb

Overview

Validator for session specific configuration.

Constant Summary collapse

STANDARD =
[ :database, :hosts, :username, :password ]

Instance Method Summary collapse

Instance Method Details

#validate(sessions) ⇒ Object

Validate the session configuration.

Examples:

Validate the session config.

Session.validate({ default: { hosts: [ "localhost:27017" ] }})

Parameters:

  • sessions (Hash)

    The sessions config.

Since:

  • 3.0.0



20
21
22
23
24
25
26
27
28
29
# File 'lib/mongoid/config/validators/session.rb', line 20

def validate(sessions)
  unless sessions.has_key?(:default)
    raise Errors::NoDefaultSession.new(sessions.keys)
  end
  sessions.each_pair do |name, config|
    validate_session_database(name, config)
    validate_session_hosts(name, config)
    validate_session_uri(name, config)
  end
end