Exception: Mongoid::Errors::UnsupportedJavascript

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

Overview

Raised when Javascript criteria selector is passed for embedded document.

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(klass, javascript) ⇒ UnsupportedJavascript

Create the new error caused by using Javascript in embedded document criteria selector.

Examples:

Create the error.

UnsupportedJavascriptSelector.new(Album, "this.name == '101'")

Parameters:

  • klass (Class)

    The embedded document class.

  • javascript (String)

    The javascript expression.



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

def initialize(klass, javascript)
  super(
    compose_message(
      "unsupported_javascript",
      { klass: klass, javascript: javascript }
    )
  )
end