Exception: TinyDyno::Errors::MissingHashKey

Inherits:
TinyDynoError
  • Object
show all
Defined in:
lib/tiny_dyno/errors/hash_key_errors.rb

Overview

This error is raised when trying to set a value in Mongoid that is not already set with dynamic attributes or the field is not defined.

Constant Summary

Constants inherited from TinyDynoError

TinyDynoError::BASE_KEY

Instance Method Summary collapse

Methods inherited from TinyDynoError

#compose_message

Constructor Details

#initialize(klass:) ⇒ MissingHashKey

Create the new error.

Examples:

Instantiate the error.

UnknownAttribute.new(Person, "gender")

Parameters:

  • klass (Class)

    The model class.

  • name (String, Symbol)

    The name of the attribute.

Since:

  • 3.0.0



44
45
46
47
48
# File 'lib/tiny_dyno/errors/hash_key_errors.rb', line 44

def initialize(klass:)
  super(
      compose_message("no hash key specified", { klass: klass.name })
  )
end