Exception: Mongoid::Errors::NoEncryptionSchema

Inherits:
MongoidError
  • Object
show all
Defined in:
lib/mongoid/errors/no_encryption_schema.rb

Overview

This error is raised when a model declares encrypted fields, but the namespace it is about to be persisted to is not covered by the automatic encryption schema of the client in use. Without a schema the driver has nothing to encrypt with, and the fields would be stored in plaintext.

Constant Summary

Constants inherited from MongoidError

MongoidError::BASE_KEY

Instance Attribute Summary

Attributes inherited from MongoidError

#problem, #resolution, #summary

Instance Method Summary collapse

Methods inherited from MongoidError

#compose_message

Constructor Details

#initialize(klass, namespace, client) ⇒ NoEncryptionSchema

Create the new error.

Examples:

Create the error.

NoEncryptionSchema.new(Band, 'music.bands', :default)

Parameters:

  • klass (Class)

    The model class.

  • namespace (String)

    The namespace the model resolved to.

  • client (String | Symbol)

    The name of the client in use.



18
19
20
21
22
23
24
25
# File 'lib/mongoid/errors/no_encryption_schema.rb', line 18

def initialize(klass, namespace, client)
  super(
    compose_message(
      'no_encryption_schema',
      { klass: klass, namespace: namespace, client: client }
    )
  )
end