Exception: TinyDyno::Errors::OnlyOneHashKeyPermitted

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

Overview

This error is raised, when a query is performed with fields specified that are not HashKeys, which would result in a table scan

Constant Summary

Constants inherited from TinyDynoError

TinyDynoError::BASE_KEY

Instance Method Summary collapse

Methods inherited from TinyDynoError

#compose_message

Constructor Details

#initialize(klass:, name:) ⇒ OnlyOneHashKeyPermitted

Create the new error.

Examples:

Instantiate the error.

OnlyOneHashKeyPermitted.new(Person, "gender")

Parameters:

  • klass (Class)

    The model class.

  • name (String, Symbol)

    The name of the attribute.

Since:

  • 3.0.0



96
97
98
99
100
# File 'lib/tiny_dyno/errors/hash_key_errors.rb', line 96

def initialize(klass:, name:)
  super(
      compose_message("you can only define one hash_key", { klass: klass.name, name: name })
  )
end