Added Ingredients model
command: rails generate redmine_plugin_model body_tracking ingredient name:string ref_unit:references ref_amount:decimal hidden:boolean source:references group:integer
This commit is contained in:
parent
54ab1c60dc
commit
b63040b037
2
app/models/ingredient.rb
Normal file
2
app/models/ingredient.rb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
class Ingredient < ActiveRecord::Base
|
||||||
|
end
|
@ -1,17 +1,30 @@
|
|||||||
class CreateUnits < ActiveRecord::Migration
|
class CreateUnits < ActiveRecord::Migration
|
||||||
def change
|
def change
|
||||||
create_table :units do |t|
|
create_table :units do |t|
|
||||||
t.references :project
|
t.references :project, index: true, foreign_key: true
|
||||||
t.string :name
|
t.string :name
|
||||||
t.string :shortname
|
t.string :shortname
|
||||||
end
|
end
|
||||||
|
add_index :units, :project_id
|
||||||
|
|
||||||
create_table :quantities do |t|
|
create_table :quantities do |t|
|
||||||
t.references :project
|
t.references :project, index: true, foreign_key: true
|
||||||
t.string :name
|
t.string :name
|
||||||
t.string :description
|
t.string :description
|
||||||
t.integer :domain
|
t.integer :domain
|
||||||
end
|
end
|
||||||
|
add_index :quantities, :project_id
|
||||||
|
|
||||||
|
create_table :ingredients do |t|
|
||||||
|
t.string :name
|
||||||
|
t.references :ref_unit, index: true, foreign_key: true
|
||||||
|
t.decimal :ref_amount
|
||||||
|
t.boolean :hidden
|
||||||
|
t.references :source, index: true, foreign_key: true
|
||||||
|
t.integer :group
|
||||||
|
end
|
||||||
|
add_index :ingredients, :ref_unit_id
|
||||||
|
add_index :ingredients, :source_id
|
||||||
|
|
||||||
reversible do |dir|
|
reversible do |dir|
|
||||||
dir.up do
|
dir.up do
|
||||||
|
9
test/unit/ingredient_test.rb
Normal file
9
test/unit/ingredient_test.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
require File.expand_path('../../test_helper', __FILE__)
|
||||||
|
|
||||||
|
class IngredientTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
|
# Replace this with your real tests.
|
||||||
|
def test_truth
|
||||||
|
assert true
|
||||||
|
end
|
||||||
|
end
|
Reference in New Issue
Block a user