Module: Mongoid::Sessions::Validators::Storage

Extended by:
Storage
Included in:
Storage
Defined in:
lib/mongoid/sessions/validators/storage.rb

Overview

Validates the options passed to :store_in.

Constant Summary

VALID_OPTIONS =
[ :collection, :database, :session ]

Instance Method Summary collapse

Instance Method Details

#validate(klass, options) ⇒ Object

Validate the options provided to :store_in.

Examples:

Validate the options.

Storage.validate(:collection_name)

Since:

  • 3.0.0



21
22
23
24
# File 'lib/mongoid/sessions/validators/storage.rb', line 21

def validate(klass, options)
  valid_keys?(options) or raise Errors::InvalidStorageOptions.new(klass, options)
  valid_parent?(klass) or raise Errors::InvalidStorageParent.new(klass)
end