class Mongoid::Errors::ImmutableAttribute
This error is raised when attempting the change the value of an immutable attribute. For example, the _id attribute is immutable, and attempting to change it on a document that has already been persisted will result in this error.
Public Class Methods
new(name, value)
click to toggle source
Create the new error.
@example Create the new error.
ImmutableAttribute.new(:_id, "1234")
@param [ Symbol | String ] name The name of the attribute. @param [ Object
] value The attempted set value.
Calls superclass method
# File lib/mongoid/errors/immutable_attribute.rb, line 20 def initialize(name, value) super( compose_message("immutable_attribute", { name: name, value: value }) ) end