diff --git a/app/models/person.rb b/app/models/person.rb index cbc3c8f..de6037b 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class Person < ApplicationRecord - belongs_to :regional_office + belongs_to :regional_office, optional: true has_one :account, dependent: :restrict_with_exception diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb index c1fcb29..8bce052 100644 --- a/spec/models/person_spec.rb +++ b/spec/models/person_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' RSpec.describe Person do subject { create :person } - it { is_expected.to belong_to(:regional_office) } + it { is_expected.to belong_to(:regional_office).optional } it { is_expected.to have_one(:account).dependent(:restrict_with_exception) }