1
0

Added Ingredient/Nutrient initialization

This commit is contained in:
cryptogopher
2019-09-15 19:55:25 +02:00
parent 9878b42655
commit 6e3cf2f189
3 changed files with 17 additions and 2 deletions

View File

@@ -4,8 +4,9 @@ class IngredientsController < ApplicationController
before_action :authorize
def index
@ingredient = Ingredient.new
@ingredient.nutrients.build
@ingredient = Ingredient.new(project: @project)
# passing attr for after_initialize
@ingredient.nutrients.new(ingredient: @ingredient)
@ingredients = @project.ingredients
end