Git Product home page Git Product logo

cook_book_lab's Introduction

Cookbook Lab

Objective

  • Use a partial to render your form
  • Practice db associations

Instructions

You have been given a very basic recipe app. Currently, it only allows users to create a recipe with information about the course (main, dessert, breakfast, etc), the cook time, the number of people served and the instructions. For the lab, you will add the ability to specify ingredients.

Phases

Phase 1 Add the RESTful routes to be able to create, read, update and delete ingredients. A controller for ingredients has already been created in app/controllers/ingredients_controller.rb. You must create the Ingredient model and use it in the controller. The ingredients table should have the following:

  • name
  • brand
  • image (BONUS)

Also, take a look at the views in app/views/recipes/. Notice how code in the edit page and in the create page is reused. The code takes advantage of a partial. Do the same with your ingredient views.

Phase 2 Add a table and a corresponding migration that associates ingredients with recipes. A recipe has many ingredients through an ingredients_quantity through table. Likewise, an ingredient has many recipes through the same through table. Adding this association also requires adding some attributes to the Recipe model and the Ingredient model.

Phase 3 Add seed data. The seed data should create a recipe and then create ingredients that are associated with that recipe. On the show page of your recipe, display the ingredients associated with the receipt. The ingredients should also list their quantities.

Phase 4 (BONUS): When the user is creating a new receipe, he should be able to specify which ingredients he wants and at what quantity. This is a challenge. You will need to understand building complex forms and nested forms.

Challenge

Make it beautiful

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.