diff options
author | Marius Peter <dev@marius-peter.com> | 2025-09-08 21:21:56 +0200 |
---|---|---|
committer | Marius Peter <dev@marius-peter.com> | 2025-09-08 21:21:56 +0200 |
commit | 7116826b854188604e21e2a613ac6672b6fd81f3 (patch) | |
tree | 33150bf2e04e69b8e1fa7d37901d2643b1955534 /app/models/target_allocation.rb | |
parent | 8ba568ae0ebe715b5da453681eb141886f1977a8 (diff) |
Create Target and nutrient target table on dashboard.
Diffstat (limited to 'app/models/target_allocation.rb')
-rw-r--r-- | app/models/target_allocation.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/target_allocation.rb b/app/models/target_allocation.rb new file mode 100644 index 0000000..6aa1dcb --- /dev/null +++ b/app/models/target_allocation.rb @@ -0,0 +1,7 @@ +class TargetAllocation < ApplicationRecord + belongs_to :target + 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 |