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

46 lines
1.0 KiB
Ruby

json.extract! @food,
:id,
:name,
:ndbn,
:usda_food_name,
: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
if @food.ndbn.present?
json.ndbn_units @food.usda_food.usda_food_weights do |fw|
json.extract! fw, :amount, :description, :gram_weight
end
else
json.ndbn_units []
end
json.ingredient_units @food.ingredient_units do |iu|
json.extract! iu, :id, :name, :gram_weight
json._destroy false
end