异常:Mongoid::Errors::ReadonlyAttribute

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

Overview

在文档持久化后尝试更改只读属性的值时,会出现此错误。

常量摘要

MongoidError继承的常量

MongoidError::BASE_KEY

实例属性摘要

MongoidError继承的属性

#问题#分辨率#summary

实例方法摘要折叠

MongoidError继承的方法

#compose_message

构造函数详情

#initialize (name, value) ⇒ ReadonlyAttribute

创建新的错误。

例子:

创建新的错误。

ReadonlyAttribute.new(:title, "mr")

参数:

  • 名称 (符号 | string )

    属性的名称。

  • ( Object )

    尝试设置值。



18
19
20
21
22
# File 'lib/mongoid/errors/readonly_attribute.rb', line 18

def 初始化(名称, )
  (
    compose_message(" readonly_attribute ", { 名称: 名称, 值:  })
  )
end