1
0

Finished Sources implementation

This commit is contained in:
cryptogopher
2019-09-23 20:13:09 +02:00
parent 35f8ec4b2c
commit 593e11ff53
7 changed files with 64 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ class IngredientsController < ApplicationController
def index
@ingredient = @project.ingredients.new
# passing attr for after_initialize
# passing attr for Nutrient after_initialize
@ingredient.nutrients.new(ingredient: @ingredient)
@ingredients = @project.ingredients.includes(:ref_unit)
@ingredients << @ingredient

View File

@@ -39,7 +39,7 @@ class SourcesController < ApplicationController
# :find_* methods are called before :authorize,
# @project is required for :authorize to succeed
def find_source
@unit = Source.find(params[:id])
@source = Source.find(params[:id])
@project = @source.project
rescue ActiveRecord::RecordNotFound
render_404