Giter Club home page Giter Club logo

mycookbook's Issues

MethodError when saving ingredient array to database

User story: User can save recipes from search to their Cookbook

Error: NoMethodError in RecipesController#create; undefined method `[]' for nil:NilClass

error arises when attempting to iterate through JSON to grab ingredients and save them into database as array; works when exact same method is used to display ingredients in search page
Already attempted:

Troubleshooting in pry...works in pry!
Adding "serialize :ingredients" to recipe model
Hours spent researching last night and can't find solution

Want to create table data two different ways but keep getting nil entries

User story: User can add their own personal recipes to Cookbook by completing form

Error: Recipes are saved with nil info

Things I've tried:
I'm trying to use control flow to have two different "routes" leading to my create method; not working and I'm having trouble finding any results on internet that seem to have a similar plan

Overall a solid project/ DRY up your controllers where possible

Hi Mary,
Nicely done on your first project. It's clear you put a lot of thought into the datamodeling and user stories (great tests!), which probably made the actual implementation a heck of a lot easier. If I have to nitpick regarding process, I'd say "Wireframe!", because wireframes will be super helpful when you get to coding up the user interface, as you'll have a blueprint to go by and therefore have almost no style-related decisions to stress over while coding.

Also, your RecipesController is uber repetitive. You could abstract the create & update actions into a function (the only conditional would be whether to split on a dollar sign versus comma/period.

MethodError when trying to save array to database but works in Pry and display

User story: User can save recipes from search to their Cookbook

Error: NoMethodError in RecipesController#create; undefined method `[]' for nil:NilClass

  • error arises when attempting to iterate through JSON to grab ingredients and save them into database as array; works when exact same method is used to display ingredients in search page

Already attempted:

  • Troubleshooting in pry...works in pry!
  • Adding "serialize :ingredients" to recipe model
  • Hours spent researching last night and can't find solution

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.