Fix UnitsiTest#test_index

This commit is contained in:
2024-12-09 20:00:14 +01:00
parent 40808639cc
commit f3f0b9dc9e
2 changed files with 3 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ class Unit < ApplicationRecord
belongs_to :user, optional: true
belongs_to :base, optional: true, class_name: "Unit"
has_many :subunits, class_name: "Unit", dependent: :restrict_with_error, inverse_of: :base
has_many :subunits, class_name: "Unit", inverse_of: :base, dependent: :restrict_with_error
validate if: ->{ base.present? } do
errors.add(:base, :user_mismatch) unless user == base.user