class Mongoid::Errors::DeleteRestriction

This error is raised when attempting to destroy a model which has an association with dependency option set to restrict.

Public Class Methods

new(document, association_name) click to toggle source

Create the new callbacks error.

@param [ Document ] document The document that was attempted to be

destroyed.

@param [ Symbol ] association_name The name of the dependent

association that prevents the document from being deleted.

@since 3.0.0

Calls superclass method
# File lib/mongoid/errors/delete_restriction.rb, line 19
def initialize(document, association_name)
  super(
    compose_message(
      "delete_restriction",
      { document: document.class, relation: association_name }
    )
  )
end