Class: Mongoid::Includes::Errors::InvalidIncludes
- Inherits:
-
Errors::MongoidError
- Object
- Errors::MongoidError
- Mongoid::Includes::Errors::InvalidIncludes
- Defined in:
- lib/mongoid/includes/errors/invalid_includes.rb
Overview
Public: This error is raised when an invalid include is performed.
Direct Known Subclasses
Instance Method Summary collapse
-
#compose_message(type, options) ⇒ Object
Overrides: Helps to keep the templates simple by using inspect on the options.
-
#initialize(klass, args, options) ⇒ InvalidIncludes
constructor
Public: Composes a message from the class the includes would be performed on, the relations to be included, and the options.
-
#type ⇒ Object
Internal: Key of the translation message.
Constructor Details
#initialize(klass, args, options) ⇒ InvalidIncludes
Public: Composes a message from the class the includes would be performed on, the relations to be included, and the options.
10 11 12 13 14 |
# File 'lib/mongoid/includes/errors/invalid_includes.rb', line 10 def initialize(klass, args, ) super (type, .merge( klass: klass, relations: klass.relations.keys, args: Array.wrap(args) )) end |
Instance Method Details
#compose_message(type, options) ⇒ Object
Overrides: Helps to keep the templates simple by using inspect on the options.
22 23 24 25 26 |
# File 'lib/mongoid/includes/errors/invalid_includes.rb', line 22 def (type, ) super type, .transform_values { |value| value.is_a?(Array) ? value.map(&:inspect).join(', ') : value.inspect } end |
#type ⇒ Object
Internal: Key of the translation message
17 18 19 |
# File 'lib/mongoid/includes/errors/invalid_includes.rb', line 17 def type :invalid_includes end |