Exception: Mongoid::Errors::InvalidType
- Inherits:
-
MongoidError
- Object
- StandardError
- MongoidError
- Mongoid::Errors::InvalidType
- Defined in:
- lib/mongoid/errors/invalid_type.rb
Overview
Raised when trying to get or set a value for a defined field, where the type of the object does not match the defined field type.
Example:
InvalidType.new(Array, "Not an Array")
Constant Summary
Constants inherited from MongoidError
Instance Method Summary collapse
-
#initialize(klass, value) ⇒ InvalidType
constructor
A new instance of InvalidType.
Methods inherited from MongoidError
Constructor Details
#initialize(klass, value) ⇒ InvalidType
Returns a new instance of InvalidType.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mongoid/errors/invalid_type.rb', line 12 def initialize(klass, value) super( translate( "invalid_type", { :klass => klass.name, :other => value.class.name, :value => value.inspect } ) ) end |