Exception: Mongoid::Errors::DeleteRestriction

Inherits:
MongoidError
  • Object
show all
Defined in:
build/mongoid-7.0/lib/mongoid/errors/delete_restriction.rb

Overview

This error is raised when calling #save! or .create! on a model when one of the callbacks returns false.

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(document, relation) ⇒ DeleteRestriction

Create the new callbacks error.

Examples:

Create the new callbacks error.

Callbacks.new(Post, :create!)

Parameters:

  • document (Class)
  • relation (Symbol)

Since:

  • 3.0.0



18
19
20
21
22
23
24
25
# File 'build/mongoid-7.0/lib/mongoid/errors/delete_restriction.rb', line 18

def initialize(document, relation)
  super(
    compose_message(
      "delete_restriction",
      { document: document.class, relation: relation }
    )
  )
end