Exception: ActiveRecord::DeleteRestrictionError

Inherits:
ActiveRecordError show all
Defined in:
activerecord/lib/active_record/associations.rb

Overview

This error is raised when trying to destroy a parent instance in N:1 or 1:1 associations (has_many, has_one) when there is at least 1 child associated instance. ex: if @project.tasks.size > 0, DeleteRestrictionError will be raised when trying to destroy @project

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ DeleteRestrictionError

:nodoc:



101
102
103
# File 'activerecord/lib/active_record/associations.rb', line 101

def initialize(name)
  super("Cannot delete record because of dependent #{name}")
end