Richa

No this does not check if the ingredient was still present, I just didn't
had the time to add that feature. Though it was always on my mind!

All these are great points, I will look through my code again to adapt
these suggestions.

Thank you :)

On Fri, Nov 14, 2014 at 4:38 PM, Andrew Gorcester <notifications@github.com>
wrote:

> In richa/cooks/app/forms/recipe_build_form.rb:
>
> > +                                recipe_id: @recipe.id,
> > +                                unit: value[UNIT],
> > +                                measurement: value[1],
> > +                                preparation: value[3])
> > +      end
> > +    end
> > +    add_ingredient
> > +    @recipe.valid?
> > +  end
> > +
> > +  # this is for the new ingredients at the bottom of the form
> > +  def add_ingredient
> > +    # add new ingredient & then add that to a recipe
> > +    @attributes[:ingredient].each do |key, value|
> > +      if value.join != ""
> > +        ingredient = Ingredient.create(name: value[0])
>
> Will this properly handle ingredients with the same name that have already
> been added to your database via another recipe?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/Ada-Projects/Ada-Cooks/pull/12/files#r20396807>.
>