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 f00f93c9e9 View tracking through params in Ingredients
Squeezed ingredient form
2020-04-04 02:13:46 +02:00

9 lines
306 B
Ruby

class Nutrient < ActiveRecord::Base
belongs_to :ingredient, inverse_of: :nutrients, required: true
belongs_to :quantity, required: true
belongs_to :unit, required: true
validates :quantity, uniqueness: {scope: :ingredient_id}
validates :amount, numericality: {greater_than_or_equal_to: 0.0}
end