diff --git a/app/models/error_detail.rb b/app/models/error_detail.rb index 47d682b29f1..ea1cece6c99 100644 --- a/app/models/error_detail.rb +++ b/app/models/error_detail.rb @@ -4,6 +4,6 @@ class ErrorDetail < ApplicationRecord include Discard::Model self.discard_column = :deleted_at - belongs_to :integration, polymorphic: true + belongs_to :integration, polymorphic: true, optional: true belongs_to :owner, polymorphic: true end diff --git a/spec/factories/invoices.rb b/spec/factories/invoices.rb index ed6f21dd526..5543d0fa2a6 100644 --- a/spec/factories/invoices.rb +++ b/spec/factories/invoices.rb @@ -24,8 +24,10 @@ payment_dispute_lost_at { DateTime.current - 1.day } end - trait :with_integration_error do - integration_error_details + trait :with_error do + after :create do |i| + create(:error_detail, owner: i) + end end end end