diff --git a/app/controllers/body_trackers_controller.rb b/app/controllers/body_trackers_controller.rb index 58b894e..6f0ea4d 100644 --- a/app/controllers/body_trackers_controller.rb +++ b/app/controllers/body_trackers_controller.rb @@ -27,8 +27,8 @@ class BodyTrackersController < BodyTrackingPluginController attrs = q.attributes.except('id', 'project_id', 'parent_id', 'lft', 'rgt', 'created_at', 'updated_at') attrs['parent'] = q.parent ? available[[q.parent.name, q.parent.domain]] : nil - attrs['formula_attributes'] = q.formula.attributes.except('id', 'quantity_id', - 'created_at', 'updated_at') + attrs['formula_attributes'] = q.formula ? q.formula.attributes + .except('id', 'quantity_id', 'created_at', 'updated_at') : {} obj = @project.quantities.create(attrs) available[[q.name, q.domain]] = obj end diff --git a/app/controllers/ingredients_controller.rb b/app/controllers/ingredients_controller.rb index e0a4d83..3ec895d 100644 --- a/app/controllers/ingredients_controller.rb +++ b/app/controllers/ingredients_controller.rb @@ -95,7 +95,7 @@ class IngredientsController < BodyTrackingPluginController i_params = { name: r.delete('Name'), - comment: r.delete('Comment'), + notes: r.delete('Notes'), ref_amount: 100.0, ref_unit: units['g'], group: r.delete('Group') || :other, @@ -184,7 +184,7 @@ class IngredientsController < BodyTrackingPluginController def ingredient_params params.require(:ingredient).permit( :name, - :comment, + :notes, :ref_amount, :ref_unit_id, :group, diff --git a/app/views/ingredients/_form.html.erb b/app/views/ingredients/_form.html.erb index 6168319..55f3ecd 100644 --- a/app/views/ingredients/_form.html.erb +++ b/app/views/ingredients/_form.html.erb @@ -2,7 +2,7 @@
<%= f.text_field :name, size: 40, required: true %>
-<%= f.text_area :comment, cols: 40, rows: 3, required: false, +
<%= f.text_area :notes, cols: 40, rows: 3, required: false, style: "width: 100%;" %>
<%= f.number_field :ref_amount, size: 8, required: true, min: 0,
diff --git a/app/views/ingredients/_index.html.erb b/app/views/ingredients/_index.html.erb
index 779e0a4..c05ac9c 100644
--- a/app/views/ingredients/_index.html.erb
+++ b/app/views/ingredients/_index.html.erb
@@ -8,7 +8,7 @@
<%= l(:field_name) %>
- <%= l(:field_comment) %>
+ <%= l(:field_notes) %>
<%= l(:field_reference) %>
<%= l(:field_group) %>
<%= l(:field_source) %>
@@ -28,7 +28,7 @@
} %>
<%= i.name %>
- <%= i.comment %>
+ <%= i.notes %>
<%= i.ref_amount %> [<%= i.ref_unit.shortname %>]
<%= i.group %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index c355f94..b9cb516 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -5,7 +5,7 @@ en:
field_taken_at_date: 'Taken at'
field_order: 'Order'
field_action: 'Action'
- field_comment: 'Comment'
+ field_notes: 'Notes'
field_reference: 'Reference'
field_group: 'Group'
field_source: 'Source'
@@ -87,7 +87,7 @@ en:
import_hints: 'CSV file has to include header with column names. Recognized column
names are:
(1) ingredient attributes, case sensitive:
- "Name" - required, "Comment" - optional, "Reference" - defaults to 100[g],
+ "Name" - required, "Notes" - optional, "Reference" - defaults to 100[g],
"Group" - defaults to "other", "Source" - optional, "SourceIdent" - optional,
(2) quantities'' names with unit short name in square brackets.
Sample header: "Name,Reference,Group,Proteins[g],Fats[g],Carbohydrates[g]".
diff --git a/db/migrate/001_create_schema.rb b/db/migrate/001_create_schema.rb
index 07dbe69..36381ce 100644
--- a/db/migrate/001_create_schema.rb
+++ b/db/migrate/001_create_schema.rb
@@ -47,7 +47,7 @@ class CreateSchema < ActiveRecord::Migration
create_table :ingredients do |t|
t.references :project
t.string :name
- t.text :comment
+ t.text :notes
t.decimal :ref_amount, precision: 12, scale: 6
t.references :ref_unit
t.integer :group