diff --git a/app/models/error_detail.rb b/app/models/error_detail.rb index 47d682b29f1b..ea1cece6c996 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 b16f1635f2bb..ea6f4edaaadc 100644 --- a/spec/factories/invoices.rb +++ b/spec/factories/invoices.rb @@ -25,7 +25,9 @@ end trait :with_error do - error_details + after :create do |i| + create(:error_detail, owner: i) + end end trait :failed do