1
0

Changed Unit.type -> .group

Added Unit validations. Added default Units.
This commit is contained in:
cryptogopher
2019-08-16 19:29:23 +02:00
parent 8082e42225
commit fea736bd36
5 changed files with 26 additions and 7 deletions

View File

@@ -4,7 +4,20 @@ class CreateUnits < ActiveRecord::Migration
t.references :project
t.string :name
t.string :shortname
t.integer :type
t.integer :group
end
reversible do |dir|
dir.up do
Unit.create project: nil, shortname: "", name: "count", group: :number
Unit.create project: nil, shortname: "%", name: "percent", group: :share
Unit.create project: nil, shortname: "g", name: "gram", group: :mass
Unit.create project: nil, shortname: "kg", name: "kilogram", group: :mass
end
dir.down do
Unit.delete_all
end
end
end
end