Skip to content

Commit 6f7b96b

Browse files
MaxLapp8
andauthored
Update activerecord/lib/active_record/persistence.rb
Co-authored-by: Petrik de Heus <[email protected]>
1 parent 5c03aff commit 6f7b96b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

activerecord/lib/active_record/persistence.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,8 @@ def verify_readonly_attribute(name)
10761076

10771077
def _raise_record_not_destroyed
10781078
@_association_destroy_exception ||= nil
1079-
raise @_association_destroy_exception || RecordNotDestroyed.new("Failed to destroy the #{self.class} record", self)
1079+
key = self.class.primary_key
1080+
raise @_association_destroy_exception || RecordNotDestroyed.new("Failed to destroy #{self.class} with #{key}=#{send(key)}", self)
10801081
ensure
10811082
@_association_destroy_exception = nil
10821083
end

0 commit comments

Comments
 (0)