Git Product home page Git Product logo

object-relations-assessment-web-051517's Introduction

Object Relations Assessment

For this assignment, we'll be working with a Yelp-style domain. We have three models - Restaurant, Customer, and Review. For our purposes, a Restaurant has many reviews, a Customer has many reviews, and Restaurant - Customer is a many to many relationship.

If you are not sketching out your domain, and thinking about single source of truth, you are doing it wrong :(

Topics

  • Classes vs Instances
  • Variable Scope ( Class, Instance, Local )
  • Object Relationships
  • Arrays and Array Methods
  • Class Methods

Notes

Your goal is to build out all of the methods listed in the deliverables. Do your best to follow Ruby best practices. For example, use higher-level array methods such as map, select, and find when appropriate in place of each

We've provided you with a console that you can use to test your code. To enter a console session, run ruby tools/console.rb. You'll be able to test out the methods that you write here.

To Submit - once you've completed all the deliverables, please copy/paste your three class definitions into the solution.rb file. Please don't submit the lab until we give you the signal.

Deliverables

Build the following methods on the customer class

  • Customer.all
    • should return all of the customers
  • Customer.find_by_name(name)
    • given a string of a full name, returns the first customer whose full name matches
  • Customer.find_all_by_first_name(name)
    • given a string of a first name, returns an array containing all customers with that first name
  • Customer.all_names
    • should return an array of all of the customer full names
  • Customer#add_review(restaurant, content)
    • given some content and a restaurant, creates a new review and associates it with that customer and that restaurant

Build out the following methods on the Review class

  • Review.all
    • returns all of the reviews
  • Review#customer
    • returns the customer for that given review
  • Review#restaurant
    • returns the restaurant for that given review

Build out the following methods on the restaurant class

  • Restaurant.all
    • returns an array of all restaurants
  • Restaurant.find_by_name(name)
    • given a string of restaurant name, returns the first restaurant that matches
  • Restaurant#reviews
    • returns an array of all reviews for that restaurant
  • Restaurant#customers
    • should return all of the customers who have written reviews of that restaurant.

object-relations-assessment-web-051517's People

Contributors

ipc103 avatar

Watchers

James Cloos avatar Chris D'Ascoli 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.