Exception: Mongoid::Errors::InvalidFieldType

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

Overview

This error is raised when trying to define a field using a :type option value that is not present in the field type mapping.

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, field, type) ⇒ InvalidFieldType

Create the new error.

Examples:

Instantiate the error.

InvalidFieldType.new('Person', 'first_name', 'stringgy')

Parameters:

  • klass (String)

    The model class.

  • field (String)

    The field on which the invalid type is used.

  • type (Symbol | String)

    The value of the field :type option.



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

def initialize(klass, field, type)
  super(
    compose_message('invalid_field_type',
      klass: klass, field: field, type_inspection: type.inspect)
  )
end