Exception: Mongoid::Errors::ReadonlyDocument

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

Overview

Raised when attempting to persist a document that was loaded from the database with partial fields.

Since:

  • 4.0.0

Constant Summary

Constants inherited from MongoidError

MongoidError::BASE_KEY

Instance Method Summary collapse

Methods inherited from MongoidError

#compose_message

Constructor Details

#initialize(klass) ⇒ ReadonlyDocument

Instnatiate the exception.

Examples:

Create the error.

ReadonlyDocument.new(Band)

Parameters:

  • klass (Class)

    The document class.

Since:

  • 4.0.0



19
20
21
# File 'lib/mongoid/errors/readonly_document.rb', line 19

def initialize(klass)
  super(compose_message("readonly_document", { klass: klass }))
end