Giter Club home page Giter Club logo

rails-pet-lab's Introduction

Pet App!

Overview

Track owners and pets!

Objectives

Practice:

  • one-to-many associations
  • validations and error handling

Getting Started

  1. Fork this repo, and clone it onto your local machine. Change directories into the project directory.
  2. Add the class copy of this repo as a new remote: git remote add upstream https://github.com/sf-wdi-labs/rails-pet-lab so that you can easily get any updates from the class copy if needed.
  3. Run bundle update then bundle install in the Terminal to update and install gems from the Gemfile. (Feel free to take a look at what's included, first.)
  4. Run rails db:create db:migrate in the Terminal to create your local database and run the migrations.
  5. Run rails s in the Terminal to start your server.
  6. Navigate to localhost:3000 in the browser - you should see a generic site#index page.
  7. Run rails routes to see what routes are available in the app.
  8. Run rails notes to see some of the things you'll do with this app

owner-pet-erd

In this part, you'll:

  • Change the Owner and Pet models so that each owner has many pets, and each pet belongs to one owner.

  • Add a foreign key to the pets table so that each pet stores a reference to its owner.

And more!

owner-pet-appointment-erd

In this part, you'll:

  • Generate a model for Appointments.

  • Set up the Pet and Appointment models so each appointment belongs to one pet and each pet can have many appointments.

  • Give the appointments table a foreign key to reference a pet.

And more!

has-many-through

In this part, you'll:

  • See an alternate way to use has_many through: for creating a "shortcut" instead of a many-to-many association.

  • Add a new association between the Owner and Appointment models so that an owner has many appointments through their pets.

And more!

In this optional section, you could try one of the following tasks:

  • Navigation: practice using path helper methods by adding link_tos to help users move among the pages of your site.

  • Full CRUD: Create or fill in routes, controllers, and views for the missing crud actions for owners, pets, and/or appointments.

  • Model Methods: Practice your Ruby skills, and get more time with the Date and DateTime built-in classes by creating custom model methods.

In this part, you'll:

  • Add validations to owners to pass tests.

  • Use flash messages to tell users what's wrong if owner creation fails.

  • Use TDD for pet validations - write tests to make sure the model requires a name and breed. Then write code to pass your tests.

And more!

rails-pet-lab's People

Contributors

bgveenstra avatar cameronjacoby avatar esthersweon avatar nathanallen avatar

Watchers

James Cloos avatar  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.