class Mongoid::Errors::UnknownModel

This error is raised when trying to instantiate a model object from the value in the ‘_type’ field of a document and the class doesn’t exist.

Public Class Methods

new(klass, value) click to toggle source

Create the new error.

@example Instantiate the error.

UnknownModel.new('InvalidClass', "invalid_class")

@param [ String ] klass The model class. @param [ String ] value The value used to determine the (invalid) class.

@since 7.0.0

Calls superclass method
# File lib/mongoid/errors/unknown_model.rb, line 20
def initialize(klass, value)
  super(
      compose_message("unknown_model", { klass: klass, value: value })
  )
end