diff options
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 |