From fa77a691ce0cc8941fe470a762f352b27f4f0563 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 23 Nov 2025 17:54:45 +0100 Subject: Last commit. --- app/models/target_allocation.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'app/models/target_allocation.rb') diff --git a/app/models/target_allocation.rb b/app/models/target_allocation.rb index 6aa1dcb..5e971a0 100644 --- a/app/models/target_allocation.rb +++ b/app/models/target_allocation.rb @@ -1,7 +1,6 @@ class TargetAllocation < ApplicationRecord - belongs_to :target + belongs_to :target, inverse_of: :target_allocations, touch: true belongs_to :nutrient_profile validates :percentage, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 100 } - validates :nutrient_profile_id, uniqueness: { scope: :target_id } end -- cgit v1.2.3