Exception: Mongoid::Errors::InvalidCollection

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

Overview

This error is raised when trying to access a Mongo::Collection from an embedded document.

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ InvalidCollection

Returns a new instance of InvalidCollection.



34
35
36
# File 'lib/mongoid/errors.rb', line 34

def initialize(klass)
  @klass = klass
end

Instance Method Details

#messageObject



37
38
39
40
41
# File 'lib/mongoid/errors.rb', line 37

def message
  "Access to the collection for #{@klass.name} is not allowed " +
    "since it is an embedded document, please access a collection from " +
    "the root document"
end