1
0

Added nutrient model

command: rails generate redmine_plugin_model body_tracking nutrient
ingredient:references quantity:references unit:references amount:decimal
This commit is contained in:
cryptogopher 2019-09-13 13:54:56 +02:00
parent ffd38195a6
commit 7062652d0d
3 changed files with 19 additions and 1 deletions

2
app/models/nutrient.rb Normal file
View File

@ -0,0 +1,2 @@
class Nutrient < ActiveRecord::Base
end

View File

@ -19,13 +19,20 @@ class CreateUnits < ActiveRecord::Migration
create_table :ingredients do |t|
t.string :name
t.references :ref_unit
t.decimal :ref_amount
t.references :ref_unit
t.boolean :hidden
t.references :source
t.integer :group
end
create_table :nutrients do |t|
t.references :ingredient
t.references :quantity
t.references :unit
t.decimal :amount
end
reversible do |dir|
dir.up do
Unit.create project: nil, shortname: "%", name: "percent"

View File

@ -0,0 +1,9 @@
require File.expand_path('../../test_helper', __FILE__)
class NutrientTest < ActiveSupport::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end