Method: Mongoid::Errors::AttributeNotLoaded#initialize

Defined in:
lib/mongoid/errors/attribute_not_loaded.rb

#initialize(klass, name) ⇒ AttributeNotLoaded

Create the new error.

Examples:

Instantiate the error.

AttributeNotLoaded.new(Person, "title")

Parameters:

  • klass (Class)

    The model class.

  • name (String | Symbol)

    The name of the attribute.



27
28
29
30
31
# File 'lib/mongoid/errors/attribute_not_loaded.rb', line 27

def initialize(klass, name)
  super(
    compose_message("attribute_not_loaded", { klass: klass.name, name: name })
  )
end