Exception: Mongoid::Errors::UnrecognizedResolver

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

Overview

Raised when a model resolver is referenced, but not registered.

class Manager
  include Mongoid::Document
  belongs_to :unit, polymorphic: :org
end

If ‘:org` has not previously been registered as a model resolver, Mongoid will raise UnrecognizedResolver when it tries to resolve a manager’s unit.

Constant Summary

Constants inherited from MongoidError

MongoidError::BASE_KEY

Instance Attribute Summary

Attributes inherited from MongoidError

#problem, #resolution, #summary

Instance Method Summary collapse

Methods inherited from MongoidError

#compose_message

Constructor Details

#initialize(resolver) ⇒ UnrecognizedResolver

Returns a new instance of UnrecognizedResolver.



16
17
18
19
20
21
22
23
24
# File 'lib/mongoid/errors/unrecognized_resolver.rb', line 16

def initialize(resolver)
  super(
    compose_message(
      'unrecognized_resolver',
      resolver: resolver.inspect,
      resolvers: [ :default, *Mongoid::ModelResolver.resolvers.keys ].inspect
    )
  )
end