diff options
| author | Marius Peter <dev@marius-peter.com> | 2025-11-23 17:54:45 +0100 |
|---|---|---|
| committer | Marius Peter <dev@marius-peter.com> | 2025-11-23 17:54:45 +0100 |
| commit | fa77a691ce0cc8941fe470a762f352b27f4f0563 (patch) | |
| tree | 08916174840a7896fc59633cc59fab931e7012c2 /app/models/target_allocation.rb | |
| parent | 73283f2f5153c77f72b6a29e98f173628f5e1057 (diff) | |
Diffstat (limited to 'app/models/target_allocation.rb')
| -rw-r--r-- | app/models/target_allocation.rb | 3 |
1 files changed, 1 insertions, 2 deletions
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 |