123456789_123456789_123456789_123456789_123456789_

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 call to #destroy would return false.

begin
  complex_operation_that_internally_calls_destroy!
rescue ActiveRecord::RecordNotDestroyed => invalid
  puts invalid.record.errors
end

Class Method Summary

Instance Attribute Summary

Constructor Details

.new(message = nil, record = nil) ⇒ RecordNotDestroyed

[ GitHub ]

  
# File 'activerecord/lib/active_record/errors.rb', line 115

def initialize(message = nil, record = nil)
  @record = record
  super(message)
end

Instance Attribute Details

#record (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record/errors.rb', line 113

attr_reader :record