Exception: ActiveRecord::DeleteRestrictionError
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
ActiveRecordError ,
StandardError
|
|
Instance Chain:
self,
ActiveRecordError ,
StandardError
|
|
Inherits: |
ActiveRecord::ActiveRecordError
|
Defined in: | activerecord/lib/active_record/associations/errors.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
Class Method Summary
- .new(name = nil) ⇒ DeleteRestrictionError constructor
Constructor Details
.new(name = nil) ⇒ DeleteRestrictionError
# File 'activerecord/lib/active_record/associations/errors.rb', line 257
def initialize(name = nil) if name super("Cannot delete record because of dependent #{name}") else super("Delete restriction error.") end end