Exception: ActiveRecord::RecordNotDestroyed
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/errors.rb |
Overview
Raised by {ActiveRecord::Base#destroy!} when a record cannot be destroyed due to any of the before_destroy
callbacks throwing :abort
. See Callbacks
for further details.
class User < ActiveRecord::Base
before_destroy do
throw :abort if still_active?
end
end
User.first.destroy! # => raises an ActiveRecord::RecordNotDestroyed
Class Method Summary
Instance Attribute Summary
- #record readonly
Constructor Details
.new(message = nil, record = nil) ⇒ RecordNotDestroyed
Instance Attribute Details
#record (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/errors.rb', line 183
attr_reader :record