Module: Mongoid::Clients::Validators::Storage

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

Overview

Validates the options passed to :store_in.

Constant Summary collapse

VALID_OPTIONS =

The valid options for storage.

[ :collection, :collection_options, :database, :client ].freeze

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)

Parameters:

  • klass (Class)

    The model class.

  • options (Hash | String | Symbol)

    The provided options.



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

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