From 7062652d0d9aa9e0a3ebc5d7844f6faa8d58a1df Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Fri, 13 Sep 2019 13:54:56 +0200 Subject: [PATCH] Added nutrient model command: rails generate redmine_plugin_model body_tracking nutrient ingredient:references quantity:references unit:references amount:decimal --- app/models/nutrient.rb | 2 ++ db/migrate/001_create_units.rb | 9 ++++++++- test/unit/nutrient_test.rb | 9 +++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 app/models/nutrient.rb create mode 100644 test/unit/nutrient_test.rb diff --git a/app/models/nutrient.rb b/app/models/nutrient.rb new file mode 100644 index 0000000..b146427 --- /dev/null +++ b/app/models/nutrient.rb @@ -0,0 +1,2 @@ +class Nutrient < ActiveRecord::Base +end diff --git a/db/migrate/001_create_units.rb b/db/migrate/001_create_units.rb index 6f5e3ea..413357f 100644 --- a/db/migrate/001_create_units.rb +++ b/db/migrate/001_create_units.rb @@ -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" diff --git a/test/unit/nutrient_test.rb b/test/unit/nutrient_test.rb new file mode 100644 index 0000000..14e2f04 --- /dev/null +++ b/test/unit/nutrient_test.rb @@ -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