From 7116826b854188604e21e2a613ac6672b6fd81f3 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Mon, 8 Sep 2025 21:21:56 +0200 Subject: Create Target and nutrient target table on dashboard. --- app/models/target_allocation.rb | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 app/models/target_allocation.rb (limited to 'app/models/target_allocation.rb') 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 -- cgit v1.2.3