parsley/app/views/foods/show.json.jbuilder

46 lines
1.0 KiB
Plaintext
Raw Normal View History

2018-04-02 00:10:06 -05:00
2018-09-11 10:38:07 -05:00
json.extract! @food,
2018-04-03 10:29:57 -05:00
:id,
:name,
:ndbn,
2018-04-03 18:31:20 -05:00
:usda_food_name,
2018-04-03 10:29:57 -05:00
:notes,
:density,
:water,
:ash,
:protein,
:kcal,
:fiber,
:sugar,
:carbohydrates,
:calcium,
:iron,
:magnesium,
:phosphorus,
:potassium,
:sodium,
:zinc,
:copper,
:manganese,
:vit_c,
:vit_b6,
:vit_b12,
:vit_a,
:vit_e,
:vit_d,
:vit_k,
:cholesterol,
:lipids
2018-04-03 18:31:20 -05:00
2018-09-11 10:38:07 -05:00
if @food.ndbn.present?
json.ndbn_units @food.usda_food.usda_food_weights do |fw|
2018-04-03 18:31:20 -05:00
json.extract! fw, :amount, :description, :gram_weight
end
else
json.ndbn_units []
end
2018-09-11 22:56:26 -05:00
json.food_units @food.food_units do |iu|
2018-04-03 18:31:20 -05:00
json.extract! iu, :id, :name, :gram_weight
json._destroy false
end