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:
parent
ffd38195a6
commit
7062652d0d
2
app/models/nutrient.rb
Normal file
2
app/models/nutrient.rb
Normal file
@ -0,0 +1,2 @@
|
||||
class Nutrient < ActiveRecord::Base
|
||||
end
|
@ -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"
|
||||
|
9
test/unit/nutrient_test.rb
Normal file
9
test/unit/nutrient_test.rb
Normal 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
|
Reference in New Issue
Block a user