异常:Mongoid::Errors::InvalidFieldType

继承:
MongoidError
  • 对象
显示全部
定义于:
lib/mongoid/errors/invalid_field_type.rb

Overview

尝试使用字段类型映射中不存在的 :type 选项值定义字段时,会出现此错误。

常量摘要

MongoidError继承的常量

MongoidError::BASE_KEY

实例属性摘要

MongoidError继承的属性

#问题#分辨率#summary

实例方法摘要折叠

MongoidError继承的方法

#compose_message

构造函数详情

#initialize (klass, 字段, type) ⇒ InvalidFieldType

创建新的错误。

例子:

实例化错误。

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

参数:

  • klass ( string )

    模型类。

  • 字段 ( string )

    使用无效类型的字段。

  • 类型 (符号 | string )

    字段:type 选项的值。



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

def 初始化(klass, 字段, 类型)
  (
    compose_message(' invalid_field_type ',
      类: klass, 字段: 字段, type_inspection: 类型.检查)
  )
end