1
0
This repository has been archived on 2023-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
body_tracking/app/models/nutrient.rb
cryptogopher fd184df9c7 Merged Nutrient and Readout into QuantityValue
Aliased date attributes of Meal and Measurement
2020-05-11 19:36:30 +02:00

10 lines
311 B
Ruby

class Nutrient < QuantityValue
belongs_to :food, inverse_of: :nutrients, required: true
validates :value, numericality: {greater_than_or_equal_to: 0.0}
# Uniqueness NOT validated here, see Value for explanation
#validates :quantity, uniqueness: {scope: :food_id}
alias_attribute :amount, :value
end