Giter VIP home page Giter VIP logo

week-4-day-4-discussion's Introduction

Rails Intro Review

Take 30 minutes to discuss the following questions with your table group.

  1. Generate a new rails app called 'Rooty Tooty Blendy Fruity'.
  2. Generate two models, 'Smoothie' and 'Ingredients', using the resource generator.
  • If a smoothie has ingredients, what sort of Active Record association should these two models have?
  • Both Smoothies and Ingredients should have name column with a String datatype, but what else should be included to set up the appropriate foreign-key relationship? Try to generate these resources without having to modify the migration files afterward. BONUS: What datatype could be used instead of :integer to generate a relationship between these models?
  1. Update/Write any needed ActiveRecord associations in the two models that were generated.
  2. Discuss amongst your table how you might do the following from here:
  • If you were to implement fully RESTful Smoothie controller, what methods would be needed?
  • What views would be needed for this to work?
  • How would you limit the route resource in config/routes.rb for Ingredients so it will only route to index and create?
  • Say we wanted to display a specific Smoothie using the show method and include the ingredients that belong to it within the view, what would be needed in the method to display both the Smoothie info and it's related ingredients? For instance:

"Green Mango Fusion"

* 1 mango
* 1 banana
* 1 cup frozen berries
* 1 bunch of kale
* 2 cups milk

week-4-day-4-discussion's People

Contributors

sophiedebenedetto avatar maxwellbenton avatar

Watchers

James Cloos avatar

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.